getVSize method
Calculates the tx segwit size
Implementation
int getVSize() {
if (!hasSegwit) return getSize();
int markerSize = 2;
int witSize = 0;
Uint8List data = Uint8List(0);
for (final w in witnesses) {
final countBytes = Uint8List.fromList([w.stack.length]);
data = Uint8List.fromList([...data, ...countBytes, ...w.toBytes()]);
}
witSize = data.length;
int size = getSize() - (markerSize + witSize);
double vSize = size + (markerSize + witSize) / 4;
return vSize.ceil();
}