Add weight / vsize
Weight / virtual size according to BIP141
This commit is contained in:
parent
757a830361
commit
c96bb93841
1 changed files with 10 additions and 0 deletions
|
@ -191,6 +191,16 @@ Transaction.prototype.hasWitnesses = function () {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Transaction.prototype.weight = function () {
|
||||||
|
var base = this.__byteLength(false)
|
||||||
|
var total = this.__byteLength(true)
|
||||||
|
return base * 3 + total
|
||||||
|
}
|
||||||
|
|
||||||
|
Transaction.prototype.virtualSize = function () {
|
||||||
|
return Math.ceil(this.weight() / 4)
|
||||||
|
}
|
||||||
|
|
||||||
Transaction.prototype.byteLength = function () {
|
Transaction.prototype.byteLength = function () {
|
||||||
return this.__byteLength(true)
|
return this.__byteLength(true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue