TxBuilder: add support for RSBuffer type keyPairs and .publicKey
This commit is contained in:
parent
b94da10e6c
commit
a868d27407
2 changed files with 22 additions and 4 deletions
|
@ -294,6 +294,19 @@ describe('TransactionBuilder', function () {
|
|||
})
|
||||
|
||||
describe('sign', function () {
|
||||
it('supports the alternative abstract interface { publicKey, sign }', function () {
|
||||
var keyPair = {
|
||||
publicKey: Buffer.alloc(33, 0x03),
|
||||
sign: function (hash) { return Buffer.alloc(64) }
|
||||
}
|
||||
|
||||
var txb = new TransactionBuilder()
|
||||
txb.addInput('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 1)
|
||||
txb.addOutput('1111111111111111111114oLvT2', 100000)
|
||||
txb.sign(0, keyPair)
|
||||
assert.equal(txb.build().toHex(), '0100000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff010000002c0930060201000201000121030303030303030303030303030303030303030303030303030303030303030303ffffffff01a0860100000000001976a914000000000000000000000000000000000000000088ac00000000')
|
||||
})
|
||||
|
||||
fixtures.invalid.sign.forEach(function (f) {
|
||||
it('throws on ' + f.exception + (f.description ? ' (' + f.description + ')' : ''), function () {
|
||||
var txb = construct(f, true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue