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)
211
211
212
212
static void MutateTxVersion (CMutableTransaction& tx, const std::string& cmdVal)
213
213
{
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) {
216
216
throw std::runtime_error (" Invalid TX version requested: '" + cmdVal + " '" );
217
217
}
218
-
219
- tx.version = newVersion;
218
+ tx.version = *ver;
220
219
}
221
220
222
221
static void MutateTxLocktime (CMutableTransaction& tx, const std::string& cmdVal)
Original file line number Diff line number Diff line change 56
56
"output_cmp" : " blanktxv2.json" ,
57
57
"description" : " Creates a blank transaction when nothing is piped into bitcoin-tx (output in json)"
58
58
},
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
+ },
59
65
{ "exec" : " ./bitcoin-tx" ,
60
66
"args" : [" -create" , " nversion=1foo" ],
61
67
"return_code" : 1 ,
You can’t perform that action at this time.
0 commit comments