mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-11 16:11:29 +00:00
bitcoin-tx: Reject + sign in locktime
This commit is contained in:
parent
dddd9e5fe3
commit
faff25a558
@ -220,11 +220,11 @@ static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal)
|
||||
|
||||
static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
|
||||
{
|
||||
int64_t newLocktime;
|
||||
if (!ParseInt64(cmdVal, &newLocktime) || newLocktime < 0LL || newLocktime > 0xffffffffLL)
|
||||
const auto locktime{ToIntegral<uint32_t>(cmdVal)};
|
||||
if (!locktime) {
|
||||
throw std::runtime_error("Invalid TX locktime requested: '" + cmdVal + "'");
|
||||
|
||||
tx.nLockTime = (unsigned int) newLocktime;
|
||||
}
|
||||
tx.nLockTime = *locktime;
|
||||
}
|
||||
|
||||
static void MutateTxRBFOptIn(CMutableTransaction& tx, const std::string& strInIdx)
|
||||
|
||||
@ -132,6 +132,12 @@
|
||||
"output_cmp": "tt-locktime317000-out.json",
|
||||
"description": "Adds an nlocktime to a transaction (output in json)"
|
||||
},
|
||||
{ "exec": "./bitcoin-tx",
|
||||
"args": ["-create", "locktime=+317"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: Invalid TX locktime requested",
|
||||
"description": "Tests the check for invalid locktime value"
|
||||
},
|
||||
{ "exec": "./bitcoin-tx",
|
||||
"args": ["-create", "locktime=317000foo"],
|
||||
"return_code": 1,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user