ScriptBuilder: Make OP_RETURN to allow 80 bytes.

Make OP_RETURN to allow 80 bytes instead of the previous 40 bytes.

This is to be consistent with the Bitcoin Core, which have made it back to 80 bytes.
This commit is contained in:
johnygeorge 2016-06-06 14:38:09 +02:00 committed by Andreas Schildbach
parent e61eb107dc
commit f33432febd
2 changed files with 12 additions and 1 deletions

View file

@ -433,7 +433,7 @@ public class ScriptBuilder {
* the ledger.
*/
public static Script createOpReturnScript(byte[] data) {
checkArgument(data.length <= 40);
checkArgument(data.length <= 80);
return new ScriptBuilder().op(OP_RETURN).data(data).build();
}

View file

@ -2167,6 +2167,17 @@ public class WalletTest extends TestWithWallet {
wallet.completeTx(request);
}
@Test
public void opReturnMaxBytes() throws Exception {
receiveATransaction(wallet, myAddress);
Transaction tx = new Transaction(PARAMS);
Script script = ScriptBuilder.createOpReturnScript(new byte[80]);
tx.addOutput(Coin.ZERO, script);
SendRequest request = SendRequest.forTx(tx);
request.ensureMinRequiredFee = true;
wallet.completeTx(request);
}
@Test
public void opReturnOneOutputWithValueTest() throws Exception {
// Tests basic send of transaction with one output that destroys coins and has an OP_RETURN.