diff --git a/.npmignore b/.npmignore index fdc9251..9de4da0 100644 --- a/.npmignore +++ b/.npmignore @@ -15,4 +15,5 @@ tsconfig.json /artifacts/**/*.scrypt.map /artifacts/**/*.json .asm/ +tsconfig-scryptTS.json diff --git a/package-lock.json b/package-lock.json index ecf5a0b..3d2d901 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "scrypt-ts-lib", - "version": "0.1.27", + "version": "0.1.28", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "scrypt-ts-lib", - "version": "0.1.27", + "version": "0.1.28", "license": "MIT", "dependencies": { "rabinsig": "^4.2.1", diff --git a/package.json b/package.json index 886bd4b..0a359f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrypt-ts-lib", - "version": "0.1.27", + "version": "0.1.28", "description": "A collection of smart contract libraries for `scrypt-ts`.", "types": "dist/index.d.ts", "main": "dist/index.js", diff --git a/src/blockchain.ts b/src/blockchain.ts index 420c829..fbbb6be 100644 --- a/src/blockchain.ts +++ b/src/blockchain.ts @@ -122,6 +122,14 @@ export class Blockchain extends SmartContractLib { return bhHash <= target && target <= blockchainTarget } + @method() + static verifyBlockHeader(bh: BlockHeader): boolean { + const bhHash = Blockchain.blockHeaderHashAsInt(bh) + const target = Blockchain.bits2Target(bh.bits) + // Block hash below target + return bhHash <= target + } + // Is a chain of block headers valid. // TODO