OSDN Git Service
(root)
/
bytom
/
bytom-java-sdk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8486069
)
fix signature
fix_retire
author
shenao78
<shenao.78@163.com>
Tue, 16 Apr 2019 06:12:24 +0000
(14:12 +0800)
committer
shenao78
<shenao.78@163.com>
Tue, 16 Apr 2019 06:12:24 +0000
(14:12 +0800)
tx-signer/src/main/java/io/bytom/offline/api/BaseInput.java
patch
|
blob
|
history
tx-signer/src/main/java/io/bytom/offline/api/SpendInput.java
patch
|
blob
|
history
tx-signer/src/test/java/io/bytom/offline/api/AppTest.java
patch
|
blob
|
history
diff --git
a/tx-signer/src/main/java/io/bytom/offline/api/BaseInput.java
b/tx-signer/src/main/java/io/bytom/offline/api/BaseInput.java
index
4963549
..
6b909a7
100644
(file)
--- 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 {
if (program == null) {
throw new IllegalArgumentException("the program id of input must be specified.");
}
if (program == null) {
throw new IllegalArgumentException("the program id of input must be specified.");
}
+ if (keyIndex == null) {
+ throw new IllegalArgumentException("the key index of input must be specified.");
+ }
if (witnessComponent.getRootPrivateKey() == null) {
throw new IllegalArgumentException("the root private key of input must be specified.");
}
if (witnessComponent.getRootPrivateKey() == null) {
throw new IllegalArgumentException("the root private key of input must be specified.");
}
diff --git
a/tx-signer/src/main/java/io/bytom/offline/api/SpendInput.java
b/tx-signer/src/main/java/io/bytom/offline/api/SpendInput.java
index
f24d055
..
0a11c32
100644
(file)
--- 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 {
byte[] privateChild;
if (bipProtocol == BIPProtocol.BIP44) {
byte[] privateChild;
if (bipProtocol == BIPProtocol.BIP44) {
- privateChild = DerivePrivateKey.bip44derivePrvKey(rootPrvKey,
AccountKeySpace
, change, controlProgramIndex);
+ privateChild = DerivePrivateKey.bip44derivePrvKey(rootPrvKey,
getKeyIndex()
, change, controlProgramIndex);
} else {
privateChild = DerivePrivateKey.bip32derivePrvKey(rootPrvKey, getKeyIndex(), AccountKeySpace, controlProgramIndex);
}
} else {
privateChild = DerivePrivateKey.bip32derivePrvKey(rootPrvKey, getKeyIndex(), AccountKeySpace, controlProgramIndex);
}
diff --git
a/tx-signer/src/test/java/io/bytom/offline/api/AppTest.java
b/tx-signer/src/test/java/io/bytom/offline/api/AppTest.java
index
efd5a64
..
6897e92
100755
(executable)
--- 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 {
input1.setChange(true);
\r
input1.setControlProgramIndex(41);
\r
input1.setSourceID("0b2cff11d1d056d95237a5f2d06059e5395e86f60e69c1e8201ea624911c0c65");
\r
input1.setChange(true);
\r
input1.setControlProgramIndex(41);
\r
input1.setSourceID("0b2cff11d1d056d95237a5f2d06059e5395e86f60e69c1e8201ea624911c0c65");
\r
+ input1.setKeyIndex(1);
\r
input1.setSourcePosition(0);
\r
\r
SpendInput input2 = new SpendInput(assetId1, 70000000000L, "0014bb8a039726df1b649738e9973db14a4b4fd4becf");
\r
input1.setSourcePosition(0);
\r
\r
SpendInput input2 = new SpendInput(assetId1, 70000000000L, "0014bb8a039726df1b649738e9973db14a4b4fd4becf");
\r
@@
-105,6
+106,7
@@
public class AppTest {
input2.setChange(true);
\r
input2.setControlProgramIndex(26);
\r
input2.setSourceID("be0ac837e832c34a02968e54dab4f95cbeceb9fb01cd378310f6ea32219ee29b");
\r
input2.setChange(true);
\r
input2.setControlProgramIndex(26);
\r
input2.setSourceID("be0ac837e832c34a02968e54dab4f95cbeceb9fb01cd378310f6ea32219ee29b");
\r
+ input2.setKeyIndex(1);
\r
input2.setSourcePosition(1);
\r
\r
Output output1 = new Output(btmAssetID, 279100000L, "001414d362694eacfa110dc20dec77d610d22340f95b");
\r
input2.setSourcePosition(1);
\r
\r
Output output1 = new Output(btmAssetID, 279100000L, "001414d362694eacfa110dc20dec77d610d22340f95b");
\r