wallet-rpc: get input paths when creating batch

This commit is contained in:
Matthew Zipkin 2022-08-19 10:28:01 -04:00
parent 1ada5b4947
commit 4e9c7fcbb1
No known key found for this signature in database
GPG key ID: E7E2984B6289C93A
2 changed files with 25 additions and 1 deletions

View file

@ -2490,6 +2490,8 @@ class RPC extends RPCBase {
async createBatch(args, help) {
const [actions, options] = this._validateBatch(args, help, 'createbatch');
options.paths = true;
const wallet = this.wallet;
const mtx = await wallet.createBatch(actions, options);
@ -2504,7 +2506,7 @@ class RPC extends RPCBase {
const valid = new Validator(args);
const check = valid.array(0);
const options = valid.obj(1);
const options = valid.obj(1, {});
const actions = [];
for (const action of check) {

View file

@ -799,6 +799,28 @@ describe('Wallet RPC Methods', function() {
await nclient.execute('generatetoaddress', [100, addr]);
});
it('should have paths when creating batch', async () => {
const json = await wclient.execute(
'createbatch',
[
[['NONE', addr, 1]]
]
);
assert(json.inputs[0].path);
});
it('should not have paths when sending batch', async () => {
const json = await wclient.execute(
'sendbatch',
[
[['NONE', addr, 1]]
]
);
assert(!json.inputs[0].path);
});
it('should not send invalid batch: OPEN arguments', async () => {
await assert.rejects(
wclient.execute(