Skip to content

Commit

Permalink
rpcclient+btcjson: support testmempoolaccept for bitcoind v22.0 and…
Browse files Browse the repository at this point in the history
… above
  • Loading branch information
yyforyongyu committed Jan 4, 2024
1 parent 5fb7d4d commit 3b15171
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions btcjson/chainsvrresults.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,10 +900,14 @@ type TestMempoolAcceptFees struct {
// EffectiveFeeRate specifies the effective feerate in BTC per KvB. May
// differ from the base feerate if, for example, there are modified
// fees from prioritisetransaction or a package feerate was used.
//
// NOTE: this field only exists in bitcoind v25.0 and above.
EffectiveFeeRate float64 `json:"effective-feerate"`

// EffectiveIncludes specifies transactions whose fees and vsizes are
// included in effective-feerate. Each item is a transaction wtxid in
// hex.
//
// NOTE: this field only exists in bitcoind v25.0 and above.
EffectiveIncludes []string `json:"effective-includes"`
}
13 changes: 10 additions & 3 deletions rpcclient/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,14 @@ const (
// BitcoindPre19 represents a bitcoind version before 0.19.0.
BitcoindPre19 BackendVersion = iota

// BitcoindPost19 represents a bitcoind version equal to or greater than
// 0.19.0.
// BitcoindPost19 represents a bitcoind version equal to or greater
// than 0.19.0.
BitcoindPost19

// BitcoindPost22 represents a bitcoind version equal to or greater
// than 22.0.0.
BitcoindPost22

// BitcoindPost25 represents a bitcoind version equal to or greater
// than 25.0.0.
BitcoindPost25
Expand All @@ -129,7 +133,10 @@ func (b BackendVersion) String() string {
return "bitcoind 0.19 and below"

case BitcoindPost19:
return "bitcoind v0.19-v0.25"
return "bitcoind v0.19-v0.22"

case BitcoindPost22:
return "bitcoind v0.22-v0.25"

case BitcoindPost25:
return "bitcoind v0.25 and above"
Expand Down
4 changes: 2 additions & 2 deletions rpcclient/rawtransactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -927,8 +927,8 @@ func (c *Client) TestMempoolAcceptAsync(txns []*wire.MsgTx,

log.Debugf("TestMempoolAcceptAsync: backend version %s", version)

// Exit early if the version is below 25.0.0.
if version < BitcoindPost25 {
// Exit early if the version is below 22.0.0.
if version < BitcoindPost22 {
err := fmt.Errorf("%w: %v", ErrBitcoindVersion, version)
return newFutureError(err)
}
Expand Down

0 comments on commit 3b15171

Please sign in to comment.