optimize redeemscript map generation
This commit is contained in:
parent
53e0371b7f
commit
326384cd4b
8 changed files with 48 additions and 35 deletions
|
|
@ -4,7 +4,6 @@ var imports = require('soop').imports();
|
|||
|
||||
function Structure() {}
|
||||
|
||||
|
||||
/*
|
||||
* Based on https://github.com/maraoz/bips/blob/master/bip-NNNN.mediawiki
|
||||
* m / purpose' / cosigner_index / change / address_index
|
||||
|
|
@ -31,6 +30,15 @@ Structure.FullBranch = function(address_index, isChange, cosigner_index) {
|
|||
sub = sub.substring(2);
|
||||
return BIP45_PUBLIC_PREFIX + '/' + sub;
|
||||
};
|
||||
|
||||
Structure.indicesForPath = function(path) {
|
||||
var s = path.split('/');
|
||||
return {
|
||||
isChange: s[3] === '1',
|
||||
index: parseInt(s[4]),
|
||||
};
|
||||
};
|
||||
|
||||
Structure.IdFullBranch = Structure.FullBranch(0, 0, ID_INDEX);
|
||||
Structure.IdBranch = Structure.Branch(0, 0, ID_INDEX);
|
||||
Structure.PURPOSE = PURPOSE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue