Test fromTransaction

This commit is contained in:
Luke Childs 2019-07-04 17:00:01 +07:00
parent e3efdbdb99
commit dc23b8cce0
2 changed files with 16 additions and 1 deletions

View file

@ -391,5 +391,11 @@
}
}
]
}
},
"fromTransaction": [
{
"transaction": "020000000258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd750000000000ffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d0100000000ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f00000000",
"result": "cHNidP8BAJoCAAAAAljoeiG1ba8MI76OcHBFbDNvfLqlyHV5JPVFiHuyq911AAAAAAD/////g40EJ9DsZQpoqka7CwmK6kQiwHGyyng1Kgd5WdB86h0BAAAAAP////8CcKrwCAAAAAAWABTYXCtx0AYLCcmIauuBXlCZHdoSTQDh9QUAAAAAFgAUAK6pouXw+HaliN9VRuh0LR2HAI8AAAAAAAAAAAA="
}
]
}

View file

@ -169,4 +169,13 @@ describe(`Psbt`, () => {
})
})
})
describe('fromTransaction', () => {
fixtures.fromTransaction.forEach(f => {
it('Creates the expected PSBT from a transaction buffer', () => {
const psbt = Psbt.fromTransaction(Buffer.from(f.transaction, 'hex'))
assert.strictEqual(psbt.toBase64(), f.result)
})
})
})
})