Skip to content

Commit

Permalink
dcrtimed: ignore the gap policy when acquiring a new address
Browse files Browse the repository at this point in the history
  • Loading branch information
dajohi committed Feb 11, 2021
1 parent 2fd7872 commit eb024fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Check out source
uses: actions/checkout@v2
- name: Install Linters
run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0"
run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.36.0"
- name: Build
env:
GO111MODULE: "on"
Expand Down
13 changes: 13 additions & 0 deletions dcrtimed/dcrtimewallet/dcrtimewallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ func (d *DcrtimeWallet) Construct(merkleRoot [sha256.Size]byte) (*chainhash.Hash
return nil, err
}

// Request a change address while ignoring the gap policy.
nextAddressRequest := &pb.NextAddressRequest{
Account: d.account,
GapPolicy: pb.NextAddressRequest_GAP_POLICY_IGNORE,
}
nextAddressResponse, err := d.wallet.NextAddress(d.ctx, nextAddressRequest)
if err != nil {
return nil, err
}

// Create transaction request.
constructRequest := &pb.ConstructTransactionRequest{
SourceAccount: d.account,
Expand All @@ -130,6 +140,9 @@ func (d *DcrtimeWallet) Construct(merkleRoot [sha256.Size]byte) (*chainhash.Hash
Amount: 0,
},
},
ChangeDestination: &pb.ConstructTransactionRequest_OutputDestination{
Address: nextAddressResponse.Address,
},
}
constructResponse, err := d.wallet.ConstructTransaction(d.ctx,
constructRequest)
Expand Down

0 comments on commit eb024fc

Please sign in to comment.