mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 17:26:28 +01:00
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:
parent
e61eb107dc
commit
f33432febd
2 changed files with 12 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue