File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -211,12 +211,11 @@ static CAmount ExtractAndValidateValue(const std::string& strValue)
211211
212212static void MutateTxVersion (CMutableTransaction& tx, const std::string& cmdVal)
213213{
214- uint32_t newVersion ;
215- if (!ParseUInt32 (cmdVal, &newVersion) || newVersion < 1 || newVersion > TX_MAX_STANDARD_VERSION) {
214+ const auto ver{ToIntegral< uint32_t >(cmdVal)} ;
215+ if (!ver || *ver < 1 || *ver > TX_MAX_STANDARD_VERSION) {
216216 throw std::runtime_error (" Invalid TX version requested: '" + cmdVal + " '" );
217217 }
218-
219- tx.version = newVersion;
218+ tx.version = *ver;
220219}
221220
222221static void MutateTxLocktime (CMutableTransaction& tx, const std::string& cmdVal)
Original file line number Diff line number Diff line change 5656 "output_cmp" : " blanktxv2.json" ,
5757 "description" : " Creates a blank transaction when nothing is piped into bitcoin-tx (output in json)"
5858 },
59+ { "exec" : " ./bitcoin-tx" ,
60+ "args" : [" -create" , " nversion=+1" ],
61+ "return_code" : 1 ,
62+ "error_txt" : " error: Invalid TX version requested" ,
63+ "description" : " Tests the check for invalid nversion value"
64+ },
5965 { "exec" : " ./bitcoin-tx" ,
6066 "args" : [" -create" , " nversion=1foo" ],
6167 "return_code" : 1 ,
You can’t perform that action at this time.
0 commit comments