mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Make error messages distinct at each failure location.
This commit is contained in:
parent
f335ff8456
commit
91ec3dd165
2 changed files with 5 additions and 5 deletions
|
|
@ -2740,11 +2740,11 @@ UniValue rawissueasset(const JSONRPCRequest& request)
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction must have at least one output.");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction must have at least one output.");
|
||||||
}
|
}
|
||||||
if (!mtx.vout[mtx.vout.size() - 1].IsFee()) {
|
if (!mtx.vout[mtx.vout.size() - 1].IsFee()) {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction must have exactly one fee output, which must be last");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Last transaction output must be fee.");
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < mtx.vout.size() - 1; i++) {
|
for (size_t i = 0; i < mtx.vout.size() - 1; i++) {
|
||||||
if (mtx.vout[i].IsFee()) {
|
if (mtx.vout[i].IsFee()) {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction must have exactly one fee output, which must be last");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction can only have one fee output.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2868,11 +2868,11 @@ UniValue rawreissueasset(const JSONRPCRequest& request)
|
||||||
|
|
||||||
// Validate fee output location, required by the implementation of reissueasset_base
|
// Validate fee output location, required by the implementation of reissueasset_base
|
||||||
if (!mtx.vout[mtx.vout.size() - 1].IsFee()) {
|
if (!mtx.vout[mtx.vout.size() - 1].IsFee()) {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction must have exactly one fee output, which must be last");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Last transaction output must be fee.");
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < mtx.vout.size() - 1; i++) {
|
for (size_t i = 0; i < mtx.vout.size() - 1; i++) {
|
||||||
if (mtx.vout[i].IsFee()) {
|
if (mtx.vout[i].IsFee()) {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction must have exactly one fee output, which must be last");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction can only have one fee output.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ class IssuanceTest(BitcoinTestFramework):
|
||||||
assert_raises_rpc_error(-8, "Transaction must have at least one output.",
|
assert_raises_rpc_error(-8, "Transaction must have at least one output.",
|
||||||
self.nodes[0].rawissueasset, raw_tx, [{"asset_amount": 1, "asset_address": valid_addr}])
|
self.nodes[0].rawissueasset, raw_tx, [{"asset_amount": 1, "asset_address": valid_addr}])
|
||||||
raw_tx = self.nodes[0].createrawtransaction([], {valid_addr: Decimal("1")})
|
raw_tx = self.nodes[0].createrawtransaction([], {valid_addr: Decimal("1")})
|
||||||
assert_raises_rpc_error(-8, "Transaction must have exactly one fee output, which must be last",
|
assert_raises_rpc_error(-8, "Last transaction output must be fee.",
|
||||||
self.nodes[0].rawissueasset, raw_tx, [{"asset_amount": 1, "asset_address": valid_addr}])
|
self.nodes[0].rawissueasset, raw_tx, [{"asset_amount": 1, "asset_address": valid_addr}])
|
||||||
|
|
||||||
# Make sure that invalid addresses are rejected.
|
# Make sure that invalid addresses are rejected.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue