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 4270d01
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/decred/dcrtime
go 1.12

require (
decred.org/dcrwallet v1.6.0-rc4
decred.org/dcrwallet v1.6.0
github.com/davecgh/go-spew v1.1.1
github.com/decred/dcrd/certgen v1.1.1
github.com/decred/dcrd/chaincfg/chainhash v1.0.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
decred.org/cspp v0.3.0/go.mod h1:UygjYilC94dER3BEU65Zzyoqy9ngJfWCD2rdJqvUs2A=
decred.org/dcrwallet v1.6.0-rc4 h1:5IT6mFa+2YMqenu6aE2LetD0N8QSUVFyAFl205PvIIE=
decred.org/dcrwallet v1.6.0-rc4/go.mod h1:lsrNbuKxkPGeHXPufxNTckwQopCEDz0r3t0a8JCKAmU=
decred.org/dcrwallet v1.6.0 h1:AyyarDNewxOEXPB8CmXioD7Dk3x6omG1hVbE9Hil9CY=
decred.org/dcrwallet v1.6.0/go.mod h1:deeiKo2RpnmPpGfmNR2fFupdq5D+fFubA8js29YjDDc=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI=
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0=
Expand Down

0 comments on commit 4270d01

Please sign in to comment.