Auto merge of #4134 - daira:fix-disable-expiry, r=Eirik0
Fix the use of 0 as expiryheight in createrawtransaction, to disable expiry fixes #4132
This commit is contained in:
commit
8770f88663
|
@ -38,7 +38,8 @@ class SignRawTransactionsTest(BitcoinTestFramework):
|
||||||
|
|
||||||
outputs = {'tmJXomn8fhYy3AFqDEteifjHRMUdKtBuTGM': 0.1}
|
outputs = {'tmJXomn8fhYy3AFqDEteifjHRMUdKtBuTGM': 0.1}
|
||||||
|
|
||||||
rawTx = self.nodes[0].createrawtransaction(inputs, outputs)
|
# Also test setting an expiry height of 0.
|
||||||
|
rawTx = self.nodes[0].createrawtransaction(inputs, outputs, 0, 0)
|
||||||
rawTxSigned = self.nodes[0].signrawtransaction(rawTx, inputs, privKeys)
|
rawTxSigned = self.nodes[0].signrawtransaction(rawTx, inputs, privKeys)
|
||||||
|
|
||||||
# 1) The transaction has a complete set of signatures
|
# 1) The transaction has a complete set of signatures
|
||||||
|
|
|
@ -543,7 +543,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, expiryheight must be nonnegative and less than %d.", TX_EXPIRY_HEIGHT_THRESHOLD));
|
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, expiryheight must be nonnegative and less than %d.", TX_EXPIRY_HEIGHT_THRESHOLD));
|
||||||
}
|
}
|
||||||
// DoS mitigation: reject transactions expiring soon
|
// DoS mitigation: reject transactions expiring soon
|
||||||
if (nextBlockHeight + TX_EXPIRING_SOON_THRESHOLD > nExpiryHeight) {
|
if (nExpiryHeight != 0 && nextBlockHeight + TX_EXPIRING_SOON_THRESHOLD > nExpiryHeight) {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER,
|
throw JSONRPCError(RPC_INVALID_PARAMETER,
|
||||||
strprintf("Invalid parameter, expiryheight should be at least %d to avoid transaction expiring soon",
|
strprintf("Invalid parameter, expiryheight should be at least %d to avoid transaction expiring soon",
|
||||||
nextBlockHeight + TX_EXPIRING_SOON_THRESHOLD));
|
nextBlockHeight + TX_EXPIRING_SOON_THRESHOLD));
|
||||||
|
|
Loading…
Reference in New Issue