Skip to content

Commit

Permalink
Fix OP_RETURN issue for registering Cash Account
Browse files Browse the repository at this point in the history
  • Loading branch information
pokkst committed Nov 4, 2019
1 parent ceac674 commit df1b032
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Binary file added WalletTemplate-test.wallet
Binary file not shown.
2 changes: 1 addition & 1 deletion core/pom.xml
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>cash.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.15.2</version>
<version>0.15.3</version>
</parent>

<artifactId>bitcoinj-core</artifactId>
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/org/bitcoinj/wallet/SendRequest.java
Expand Up @@ -239,10 +239,10 @@ public static SendRequest createCashAccount(NetworkParameters params, String des
String hash160 = new String(Hex.encode(destination.getHash160()), StandardCharsets.UTF_8);
req.tx = new Transaction(params);
req.tx.addOutput(Coin.parseCoin("0.00001"), destination);
ScriptBuilder scriptBuilder = new ScriptBuilder().op(ScriptOpCodes.OP_RETURN);
scriptBuilder.addChunk(new ScriptChunk(ScriptOpCodes.OP_PUSHDATA1, Hex.decode("01010101")));
scriptBuilder.addChunk(new ScriptChunk(ScriptOpCodes.OP_PUSHDATA1, cashAccountName.getBytes()));
scriptBuilder.addChunk(new ScriptChunk(ScriptOpCodes.OP_PUSHDATA1, Hex.decode("01" + hash160)));
ScriptBuilder scriptBuilder = new ScriptBuilder().op(ScriptOpCodes.OP_RETURN)
.data(Hex.decode("01010101"))
.data(cashAccountName.getBytes())
.data(Hex.decode("01" + hash160));
Script script = scriptBuilder.build();
req.tx.addOutput(Coin.ZERO, script);
return req;
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>cash.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.15.2</version>
<version>0.15.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>cash.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.15.2</version>
<version>0.15.3</version>
<packaging>pom</packaging>

<modules>
Expand Down
2 changes: 1 addition & 1 deletion tools/pom.xml
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>cash.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.15.2</version>
<version>0.15.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion wallettemplate/pom.xml
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>cash.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.15.2</version>
<version>0.15.3</version>
</parent>

<artifactId>wallettemplate</artifactId>
Expand Down

0 comments on commit df1b032

Please sign in to comment.