Get witness data as well for Coinbase Transaction.

This commit is contained in:
Sky Young 2018-10-20 13:25:54 -06:00
parent 60e19a7b02
commit 16005103e0
2 changed files with 12 additions and 2 deletions

View File

@ -328,7 +328,7 @@ BlockTemplate.prototype.createCoinbase = function createCoinbase(hash) {
BlockTemplate.prototype.refresh = function refresh() {
const hash = this.getWitnessHash();
const cb = this.createCoinbase(hash);
const raw = cb.toNormal();
const raw = cb.toRaw();
let size = 0;
size += 4; // version
@ -336,6 +336,16 @@ BlockTemplate.prototype.refresh = function refresh() {
size += cb.inputs[0].getSize(); // input size
size -= 4 + 4 + 4; // -(nonce1 + nonce2 + sequence)
// Add to the size for floData :)
let bufferLength = Buffer.from(this.strFloData).length;
if (this.strFloData.length > 0){
size += encoding.sizeVarint(bufferLength);
size += bufferLength
} else {
size += encoding.sizeVarint(0);
}
// Cut off right after the nonce
// push and before the sequence.
const left = raw.slice(0, size);

View File

@ -1,6 +1,6 @@
{
"name": "fcoin",
"version": "1.0.0-beta.30",
"version": "1.0.0-beta.31",
"description": "Flo bike-shed",
"license": "MIT",
"repository": "git://github.com/oipwg/fcoin.git",