Get witness data as well for Coinbase Transaction.
This commit is contained in:
parent
60e19a7b02
commit
16005103e0
@ -328,7 +328,7 @@ BlockTemplate.prototype.createCoinbase = function createCoinbase(hash) {
|
|||||||
BlockTemplate.prototype.refresh = function refresh() {
|
BlockTemplate.prototype.refresh = function refresh() {
|
||||||
const hash = this.getWitnessHash();
|
const hash = this.getWitnessHash();
|
||||||
const cb = this.createCoinbase(hash);
|
const cb = this.createCoinbase(hash);
|
||||||
const raw = cb.toNormal();
|
const raw = cb.toRaw();
|
||||||
let size = 0;
|
let size = 0;
|
||||||
|
|
||||||
size += 4; // version
|
size += 4; // version
|
||||||
@ -336,6 +336,16 @@ BlockTemplate.prototype.refresh = function refresh() {
|
|||||||
size += cb.inputs[0].getSize(); // input size
|
size += cb.inputs[0].getSize(); // input size
|
||||||
size -= 4 + 4 + 4; // -(nonce1 + nonce2 + sequence)
|
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
|
// Cut off right after the nonce
|
||||||
// push and before the sequence.
|
// push and before the sequence.
|
||||||
const left = raw.slice(0, size);
|
const left = raw.slice(0, size);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "fcoin",
|
"name": "fcoin",
|
||||||
"version": "1.0.0-beta.30",
|
"version": "1.0.0-beta.31",
|
||||||
"description": "Flo bike-shed",
|
"description": "Flo bike-shed",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "git://github.com/oipwg/fcoin.git",
|
"repository": "git://github.com/oipwg/fcoin.git",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user