Skip to content

Commit 4270d01

Browse files
committed
dcrtimed: ignore the gap policy when acquiring a new address
1 parent 2fd7872 commit 4270d01

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Check out source
1616
uses: actions/checkout@v2
1717
- name: Install Linters
18-
run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0"
18+
run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.36.0"
1919
- name: Build
2020
env:
2121
GO111MODULE: "on"

dcrtimed/dcrtimewallet/dcrtimewallet.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ func (d *DcrtimeWallet) Construct(merkleRoot [sha256.Size]byte) (*chainhash.Hash
115115
return nil, err
116116
}
117117

118+
// Request a change address while ignoring the gap policy.
119+
nextAddressRequest := &pb.NextAddressRequest{
120+
Account: d.account,
121+
GapPolicy: pb.NextAddressRequest_GAP_POLICY_IGNORE,
122+
}
123+
nextAddressResponse, err := d.wallet.NextAddress(d.ctx, nextAddressRequest)
124+
if err != nil {
125+
return nil, err
126+
}
127+
118128
// Create transaction request.
119129
constructRequest := &pb.ConstructTransactionRequest{
120130
SourceAccount: d.account,
@@ -130,6 +140,9 @@ func (d *DcrtimeWallet) Construct(merkleRoot [sha256.Size]byte) (*chainhash.Hash
130140
Amount: 0,
131141
},
132142
},
143+
ChangeDestination: &pb.ConstructTransactionRequest_OutputDestination{
144+
Address: nextAddressResponse.Address,
145+
},
133146
}
134147
constructResponse, err := d.wallet.ConstructTransaction(d.ctx,
135148
constructRequest)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/decred/dcrtime
33
go 1.12
44

55
require (
6-
decred.org/dcrwallet v1.6.0-rc4
6+
decred.org/dcrwallet v1.6.0
77
github.com/davecgh/go-spew v1.1.1
88
github.com/decred/dcrd/certgen v1.1.1
99
github.com/decred/dcrd/chaincfg/chainhash v1.0.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
22
decred.org/cspp v0.3.0/go.mod h1:UygjYilC94dER3BEU65Zzyoqy9ngJfWCD2rdJqvUs2A=
3-
decred.org/dcrwallet v1.6.0-rc4 h1:5IT6mFa+2YMqenu6aE2LetD0N8QSUVFyAFl205PvIIE=
4-
decred.org/dcrwallet v1.6.0-rc4/go.mod h1:lsrNbuKxkPGeHXPufxNTckwQopCEDz0r3t0a8JCKAmU=
3+
decred.org/dcrwallet v1.6.0 h1:AyyarDNewxOEXPB8CmXioD7Dk3x6omG1hVbE9Hil9CY=
4+
decred.org/dcrwallet v1.6.0/go.mod h1:deeiKo2RpnmPpGfmNR2fFupdq5D+fFubA8js29YjDDc=
55
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
66
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI=
77
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0=

0 commit comments

Comments
 (0)