rpc: Added totalSigs to JSON response for scriptToJSON

- Added totalSigs property to the JSON response object
- Use getMultisig() function to return n value if available
This commit is contained in:
Nathan Woodburn 2023-06-26 17:58:06 +10:00
parent 90cdf84e72
commit 14d2fd2a27
No known key found for this signature in database
GPG key ID: 203B000478AD0EF1

View file

@ -2984,17 +2984,21 @@ class RPC extends RPCBase {
hex: undefined,
type: Script.typesByVal[type],
reqSigs: 1,
totalSigs: 1,
p2sh: undefined
};
if (hex)
json.hex = script.toJSON();
const [m] = script.getMultisig();
const [m, n] = script.getMultisig();
if (m !== -1)
json.reqSigs = m;
if (n !== -1)
json.totalSigs = n;
return json;
}