Improve error message about non-active segwit on simnet
I started playing with simnet and was confronted with error message: ``` [ERR] FNDG: Unable to broadcast funding tx for ChannelPoint(<point>:0): -22: TX rejected: transaction <tx> has witness data, but segwit isn't active yet ``` I wasn't aware of the activation period so I got quite puzzled. Google helped. But I think the message could mention likely cause. Newly it optionally prints something like: ``` (The threshold for segwit activation is 300 blocks on simnet, current best height is 113) ```
This commit is contained in:
parent
8512affc59
commit
b298415583
1 changed files with 8 additions and 2 deletions
|
@ -927,7 +927,7 @@ func (mp *TxPool) validateReplacement(tx *btcutil.Tx,
|
|||
func (mp *TxPool) maybeAcceptTransaction(tx *btcutil.Tx, isNew, rateLimit, rejectDupOrphans bool) ([]*chainhash.Hash, *TxDesc, error) {
|
||||
txHash := tx.Hash()
|
||||
|
||||
// If a transaction has iwtness data, and segwit isn't active yet, If
|
||||
// If a transaction has witness data, and segwit isn't active yet, If
|
||||
// segwit isn't active yet, then we won't accept it into the mempool as
|
||||
// it can't be mined yet.
|
||||
if tx.MsgTx().HasWitness() {
|
||||
|
@ -937,8 +937,14 @@ func (mp *TxPool) maybeAcceptTransaction(tx *btcutil.Tx, isNew, rateLimit, rejec
|
|||
}
|
||||
|
||||
if !segwitActive {
|
||||
simnetHint := ""
|
||||
if mp.cfg.ChainParams.Net == wire.SimNet {
|
||||
bestHeight := mp.cfg.BestHeight()
|
||||
simnetHint = fmt.Sprintf(" (The threshold for segwit activation is 300 blocks on simnet, "+
|
||||
"current best height is %d)", bestHeight)
|
||||
}
|
||||
str := fmt.Sprintf("transaction %v has witness data, "+
|
||||
"but segwit isn't active yet", txHash)
|
||||
"but segwit isn't active yet%s", txHash, simnetHint)
|
||||
return nil, nil, txRuleError(wire.RejectNonstandard, str)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue