Official Java SDK for Bytom
Révision | 089a0b16330df95c100c70a031bafe415a2fcfe8 (tree) |
---|---|
l'heure | 2019-04-16 15:12:24 |
Auteur | shenao78 <shenao.78@163....> |
Commiter | shenao78 |
fix signature
@@ -70,6 +70,9 @@ public abstract class BaseInput { | ||
70 | 70 | if (program == null) { |
71 | 71 | throw new IllegalArgumentException("the program id of input must be specified."); |
72 | 72 | } |
73 | + if (keyIndex == null) { | |
74 | + throw new IllegalArgumentException("the key index of input must be specified."); | |
75 | + } | |
73 | 76 | if (witnessComponent.getRootPrivateKey() == null) { |
74 | 77 | throw new IllegalArgumentException("the root private key of input must be specified."); |
75 | 78 | } |
@@ -52,7 +52,7 @@ public class SpendInput extends BaseInput { | ||
52 | 52 | |
53 | 53 | byte[] privateChild; |
54 | 54 | if (bipProtocol == BIPProtocol.BIP44) { |
55 | - privateChild = DerivePrivateKey.bip44derivePrvKey(rootPrvKey, AccountKeySpace, change, controlProgramIndex); | |
55 | + privateChild = DerivePrivateKey.bip44derivePrvKey(rootPrvKey, getKeyIndex(), change, controlProgramIndex); | |
56 | 56 | } else { |
57 | 57 | privateChild = DerivePrivateKey.bip32derivePrvKey(rootPrvKey, getKeyIndex(), AccountKeySpace, controlProgramIndex); |
58 | 58 | } |
@@ -98,6 +98,7 @@ public class AppTest { | ||
98 | 98 | input1.setChange(true); |
99 | 99 | input1.setControlProgramIndex(41); |
100 | 100 | input1.setSourceID("0b2cff11d1d056d95237a5f2d06059e5395e86f60e69c1e8201ea624911c0c65"); |
101 | + input1.setKeyIndex(1); | |
101 | 102 | input1.setSourcePosition(0); |
102 | 103 | |
103 | 104 | SpendInput input2 = new SpendInput(assetId1, 70000000000L, "0014bb8a039726df1b649738e9973db14a4b4fd4becf"); |
@@ -105,6 +106,7 @@ public class AppTest { | ||
105 | 106 | input2.setChange(true); |
106 | 107 | input2.setControlProgramIndex(26); |
107 | 108 | input2.setSourceID("be0ac837e832c34a02968e54dab4f95cbeceb9fb01cd378310f6ea32219ee29b"); |
109 | + input2.setKeyIndex(1); | |
108 | 110 | input2.setSourcePosition(1); |
109 | 111 | |
110 | 112 | Output output1 = new Output(btmAssetID, 279100000L, "001414d362694eacfa110dc20dec77d610d22340f95b"); |