-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const chai = require('chai'); | ||
chai.use(require('chai-as-promised')); | ||
const expect = chai.expect; | ||
|
||
const rsk = require('peglib').rsk; | ||
const redeemScriptParser = require('@rsksmart/powpeg-redeemscript-parser'); | ||
const CustomError = require('../lib/CustomError'); | ||
const removePrefix0x = require("../lib/utils").removePrefix0x; | ||
const { GENESIS_FEDERATION_ADDRESS, GENESIS_FEDERATION_REDEEM_SCRIPT } = require('../lib/constants'); | ||
|
||
describe('Calling getActivePowpegRedeemScript method after last fork before fedchange', function() { | ||
|
||
before(() => { | ||
rskClient = rsk.getClient(Runners.hosts.federate.host); | ||
}); | ||
|
||
it('should return the active powpeg redeem script', async () => { | ||
try{ | ||
const activePowpegRedeemScript = await rskClient.rsk.bridge.methods.getActivePowpegRedeemScript().call(); | ||
const activeFederationAddressFromBridge = await rskClient.rsk.bridge.methods.getFederationAddress().call(); | ||
const addressFromRedeemScript = redeemScriptParser.getAddressFromRedeemScript( | ||
'REGTEST', Buffer.from(removePrefix0x(activePowpegRedeemScript), 'hex') | ||
); | ||
|
||
expect(activePowpegRedeemScript).to.eq(GENESIS_FEDERATION_REDEEM_SCRIPT); | ||
expect(addressFromRedeemScript).to.eq(GENESIS_FEDERATION_ADDRESS).to.eq(activeFederationAddressFromBridge); | ||
} catch (err) { | ||
throw new CustomError('getActivePowpegRedeemScript method validation failure', err); | ||
} | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters