* Inject properties from a pay-to-pubkey script. * @private * @param {Buffer} key
(key)
| 1410 | */ |
| 1411 | |
| 1412 | fromPubkey(key) { |
| 1413 | assert(Buffer.isBuffer(key) && (key.length === 33 || key.length === 65)); |
| 1414 | |
| 1415 | this.raw = Buffer.allocUnsafe(1 + key.length + 1); |
| 1416 | this.raw[0] = key.length; |
| 1417 | key.copy(this.raw, 1); |
| 1418 | this.raw[1 + key.length] = opcodes.OP_CHECKSIG; |
| 1419 | |
| 1420 | key = this.raw.slice(1, 1 + key.length); |
| 1421 | |
| 1422 | this.code.length = 0; |
| 1423 | this.code.push(Opcode.fromPush(key)); |
| 1424 | this.code.push(Opcode.fromOp(opcodes.OP_CHECKSIG)); |
| 1425 | |
| 1426 | return this; |
| 1427 | } |
| 1428 | |
| 1429 | /** |
| 1430 | * Create a pay-to-pubkey script. |
no test coverage detected