Move tests to TypeScript (coverage is still JS based)

This commit is contained in:
junderw 2019-09-07 13:42:03 +09:00
parent 11e4a12caf
commit 6c08a0be40
No known key found for this signature in database
GPG key ID: B256185D3A971908
41 changed files with 3920 additions and 2712 deletions
ts_src

View file

@ -148,7 +148,7 @@ export class Block {
return anyTxHasWitness(this.transactions!);
}
byteLength(headersOnly: boolean): number {
byteLength(headersOnly?: boolean): number {
if (headersOnly || !this.transactions) return 80;
return (
@ -174,7 +174,7 @@ export class Block {
}
// TODO: buffer, offset compatibility
toBuffer(headersOnly: boolean): Buffer {
toBuffer(headersOnly?: boolean): Buffer {
const buffer: Buffer = Buffer.allocUnsafe(this.byteLength(headersOnly));
let offset: number = 0;
@ -213,7 +213,7 @@ export class Block {
return buffer;
}
toHex(headersOnly: boolean): string {
toHex(headersOnly?: boolean): string {
return this.toBuffer(headersOnly).toString('hex');
}