• R/O
  • HTTP
  • SSH
  • HTTPS

bytom-java-sdk: Commit

Official Java SDK for Bytom


Commit MetaInfo

Révisionb784a706fe91ca57eaadbd7bc47701745f05c918 (tree)
l'heure2019-04-16 15:14:46
Auteurmuscle_boy <shenao.78@163....>
CommiterGitHub

Message de Log

Merge pull request #13 from Bytom/fix_retire

fix signature

Change Summary

Modification

--- a/tx-signer/src/main/java/io/bytom/offline/api/BaseInput.java
+++ b/tx-signer/src/main/java/io/bytom/offline/api/BaseInput.java
@@ -70,6 +70,9 @@ public abstract class BaseInput {
7070 if (program == null) {
7171 throw new IllegalArgumentException("the program id of input must be specified.");
7272 }
73+ if (keyIndex == null) {
74+ throw new IllegalArgumentException("the key index of input must be specified.");
75+ }
7376 if (witnessComponent.getRootPrivateKey() == null) {
7477 throw new IllegalArgumentException("the root private key of input must be specified.");
7578 }
--- a/tx-signer/src/main/java/io/bytom/offline/api/SpendInput.java
+++ b/tx-signer/src/main/java/io/bytom/offline/api/SpendInput.java
@@ -52,7 +52,7 @@ public class SpendInput extends BaseInput {
5252
5353 byte[] privateChild;
5454 if (bipProtocol == BIPProtocol.BIP44) {
55- privateChild = DerivePrivateKey.bip44derivePrvKey(rootPrvKey, AccountKeySpace, change, controlProgramIndex);
55+ privateChild = DerivePrivateKey.bip44derivePrvKey(rootPrvKey, getKeyIndex(), change, controlProgramIndex);
5656 } else {
5757 privateChild = DerivePrivateKey.bip32derivePrvKey(rootPrvKey, getKeyIndex(), AccountKeySpace, controlProgramIndex);
5858 }
--- a/tx-signer/src/test/java/io/bytom/offline/api/AppTest.java
+++ b/tx-signer/src/test/java/io/bytom/offline/api/AppTest.java
@@ -98,6 +98,7 @@ public class AppTest {
9898 input1.setChange(true);
9999 input1.setControlProgramIndex(41);
100100 input1.setSourceID("0b2cff11d1d056d95237a5f2d06059e5395e86f60e69c1e8201ea624911c0c65");
101+ input1.setKeyIndex(1);
101102 input1.setSourcePosition(0);
102103
103104 SpendInput input2 = new SpendInput(assetId1, 70000000000L, "0014bb8a039726df1b649738e9973db14a4b4fd4becf");
@@ -105,6 +106,7 @@ public class AppTest {
105106 input2.setChange(true);
106107 input2.setControlProgramIndex(26);
107108 input2.setSourceID("be0ac837e832c34a02968e54dab4f95cbeceb9fb01cd378310f6ea32219ee29b");
109+ input2.setKeyIndex(1);
108110 input2.setSourcePosition(1);
109111
110112 Output output1 = new Output(btmAssetID, 279100000L, "001414d362694eacfa110dc20dec77d610d22340f95b");
Afficher sur ancien navigateur de dépôt.