bitcoin-tx: Reject + sign in locktime
This commit is contained in:
2 files changed
+10
-4
No files matched your search
+4
-4
@@ -220,11 +220,11 @@ static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal)
|
|||||||
|
|
||||||
static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
|
static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
|
||||||
{
|
{
|
||||||
int64_t newLocktime;
|
const auto locktime{ToIntegral<uint32_t>(cmdVal)};
|
||||||
if (!ParseInt64(cmdVal, &newLocktime) || newLocktime < 0LL || newLocktime > 0xffffffffLL)
|
if (!locktime) {
|
||||||
throw std::runtime_error("Invalid TX locktime requested: '" + cmdVal + "'");
|
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)
|
static void MutateTxRBFOptIn(CMutableTransaction& tx, const std::string& strInIdx)
|
||||||
|
|||||||
@@ -132,6 +132,12 @@
|
|||||||
"output_cmp": "tt-locktime317000-out.json",
|
"output_cmp": "tt-locktime317000-out.json",
|
||||||
"description": "Adds an nlocktime to a transaction (output in 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",
|
{ "exec": "./bitcoin-tx",
|
||||||
"args": ["-create", "locktime=317000foo"],
|
"args": ["-create", "locktime=317000foo"],
|
||||||
"return_code": 1,
|
"return_code": 1,
|
||||||
|
|||||||
Reference in new issue
Block a user