New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client: bond rotation #2036
client: bond rotation #2036
Changes from all commits
5b8b75a
9bc64d4
4074e33
3443457
9450861
4398e94
a5b0770
a399d74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -546,7 +546,7 @@ func (w *spvWallet) ExternalAddress(ctx context.Context, _ string) (stdaddr.Addr | |
// InternalAddress returns an internal address using GapPolicyIgnore. | ||
// Part of the Wallet interface. | ||
func (w *spvWallet) InternalAddress(ctx context.Context, _ string) (stdaddr.Address, error) { | ||
return w.NewInternalAddress(ctx, w.acctNum, wallet.WithGapPolicyIgnore()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the SPV wallet, match the external address method here. Plus I think we have 250 as the gap limit for our native wallet, although I haven't verified that. Native wallet recover with gap limit violations is much harder than external where the user just adds CLI switches, so let's avoid that at all costs. |
||
return w.NewInternalAddress(ctx, w.acctNum, wallet.WithGapPolicyWrap()) | ||
} | ||
|
||
// SignRawTransaction signs the provided transaction. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -477,7 +477,7 @@ type Bonder interface { | |
// provided amount, lock time, and dex account ID. An explicit private key | ||
// type is used to guarantee it's not bytes from something else like a | ||
// public key. | ||
MakeBondTx(ver uint16, amt uint64, lockTime time.Time, privKey *secp256k1.PrivateKey, acctID []byte) (*Bond, error) | ||
MakeBondTx(ver uint16, amt, feeRate uint64, lockTime time.Time, privKey *secp256k1.PrivateKey, acctID []byte) (*Bond, error) | ||
// RefundBond will refund the bond given the full bond output details and | ||
// private key to spend it. | ||
RefundBond(ctx context.Context, ver uint16, coinID, script []byte, amt uint64, privKey *secp256k1.PrivateKey) ([]byte, error) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I should mention that I've made |
||
|
@@ -745,16 +745,13 @@ type PeerManager interface { | |
// and lock time. These data are intended for the "post bond" request, in which | ||
// the server pre-validates the unsigned transaction, the client then publishes | ||
// the corresponding signed transaction, and a final request is made once the | ||
// bond is fully confirmed. The bond key is kept in this struct to keep it | ||
// coupled with the bond identity, and a redeem transaction is provided as a | ||
// backup. | ||
// bond is fully confirmed. The caller should manage the private key. | ||
type Bond struct { | ||
Version uint16 | ||
AssetID uint32 | ||
Amount uint64 | ||
CoinID []byte | ||
Data []byte // additional data to interpret the bond e.g. redeem script, bond contract, etc. | ||
BondPrivKey []byte // caller provided, but kept with the output | ||
Version uint16 | ||
AssetID uint32 | ||
Amount uint64 | ||
CoinID []byte | ||
Data []byte // additional data to interpret the bond e.g. redeem script, bond contract, etc. | ||
// SignedTx and UnsignedTx are the opaque (raw bytes) signed and unsigned | ||
// bond creation transactions, in whatever encoding and funding scheme for | ||
// this asset and wallet. The unsigned one is used to pre-validate this bond | ||
|
@@ -763,7 +760,7 @@ type Bond struct { | |
// published by the wallet. | ||
SignedTx, UnsignedTx []byte | ||
// RedeemTx is a backup transaction that spends the bond output. Normally | ||
// the BondPrivKey will be used when the bond expires. | ||
// the a key index will be used to derive the key when the bond expires. | ||
RedeemTx []byte | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the revised comment states, with an external dcrwallet, the user can pick their
--gaplimit
as desired. Using ignore with the RPC has created difficult recover situations. TheInternalAddress
method already uses wrap implicitly (getrawchangeaddress
does not even expose gap policy).Separate commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if addresses that are known to be used are skipped when using
GapPolicyWrap
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an address is used, the next (unused) address index becomes the address to which wrapping returns. The wrap algo just ensures the gap limit isn't exceeded.