Skip to content

Commit e2abb79

Browse files
authored
Merge pull request #2 from twostack/1-3-0-SNAPSHOT
Transaction ID Bugfix
2 parents ad10033 + 9672be1 commit e2abb79

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group 'org.twostack'
9-
version '1.2.0-SNAPSHOT'
9+
version '1.3.0'
1010

1111
repositories {
1212
mavenCentral()

src/main/java/org/twostack/bitcoin4j/PrivateKey.java

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public byte[] sign(byte[] buffer){
4444
return sig.encodeToDER();
4545
}
4646

47+
48+
//FIXME: We can use DumpedPrivateKey to replace the internals here
4749
public static PrivateKey fromWIF(String wif) throws InvalidKeyException {
4850

4951
boolean isCompressed = false;
@@ -82,6 +84,10 @@ public static PrivateKey fromWIF(String wif) throws InvalidKeyException {
8284
return new PrivateKey(key, isCompressed, networkType);
8385
}
8486

87+
public String toWif(NetworkType networkType){
88+
return this.key.getPrivateKeyAsWiF(networkType);
89+
}
90+
8591

8692
private static NetworkType decodeNetworkType(String wifKey) throws InvalidKeyException{
8793

src/main/java/org/twostack/bitcoin4j/transaction/Transaction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public byte[] getTransactionIdBytes(){
259259
return new byte[]{};
260260
}
261261

262-
return txHash.array();
262+
return Utils.reverseBytes(txHash.array());
263263
}
264264

265265
public void addOutput(TransactionOutput output) {

0 commit comments

Comments
 (0)