From 244af663bb8b01531d64129f88640c43c20b05cd Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 1 Dec 2016 04:48:00 -0800 Subject: [PATCH] coins: comments. --- lib/blockchain/coins.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/blockchain/coins.js b/lib/blockchain/coins.js index cd18e75e..4712c701 100644 --- a/lib/blockchain/coins.js +++ b/lib/blockchain/coins.js @@ -191,16 +191,20 @@ Coins.prototype.isEmpty = function isEmpty() { * Coins serialization: * version: varint * height: uint32 - * header-code: varint (31-bit fields | 1-bit coinbase-flag) + * header-code: varint + * bit 1: coinbase + * bit 2: first output unspent + * bit 3: second output unspent + * bit 4-32: spent-field size * spent-field: bitfield (0=spent, 1=unspent) * outputs (repeated): * value: varint * compressed-script: - * prefix: - * 0x00 = 20 byte pubkey hash + * prefix: 0x00 = 20 byte pubkey hash * 0x01 = 20 byte script hash * 0x02-0x05 = 32 byte ec-key x-value - * >=0x06 = varint-size + 10 | raw script + * 0x06-0x09 = reserved + * >=0x10 = varint-size + 10 | raw script * data: script data, dictated by the prefix * * The compression below sacrifices some cpu in exchange