add address to scriptSig.

This commit is contained in:
Christopher Jeffrey 2014-11-06 02:55:22 -08:00
parent 4c372133db
commit 78c38743d8
2 changed files with 10 additions and 0 deletions

View File

@ -159,6 +159,7 @@ bitcoind.on('open', function(status) {
if (argv['on-block']) {
return bitcoind.on('block', function callee(block) {
if (block.tx.length === 1) return;
bitcoind.log('Found Block:');
bitcoind.log(block);
return assertHex(block);

View File

@ -5262,6 +5262,15 @@ ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local<Object> jstx) {
Local<Object> o = NanNew<Object>();
o->Set(NanNew<String>("asm"), NanNew<String>(txin.scriptSig.ToString()));
o->Set(NanNew<String>("hex"), NanNew<String>(HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
CTransaction prev_tx;
if (GetTransaction(txin.prevout.hash, prev_tx, block_hash, true)) {
CTxDestination from;
ExtractDestination(prev_tx.vout[txin.prevout.n].scriptPubKey, from);
CBitcoinAddress addrFrom(from);
o->Set(NanNew<String>("address"), NanNew<String>(addrFrom.ToString()));
}
in->Set(NanNew<String>("scriptSig"), o);
in->Set(NanNew<String>("sequence"), NanNew<Number>((unsigned int)txin.nSequence)->ToUint32());