diff --git a/core/src/bitcoin.proto b/core/src/bitcoin.proto index 4223513e..5fac069d 100644 --- a/core/src/bitcoin.proto +++ b/core/src/bitcoin.proto @@ -77,6 +77,14 @@ message Key { optional int64 creation_timestamp = 5; } +message Script { + required bytes program = 1; + + // Timestamp stored as millis since epoch. Useful for skipping block bodies before this point + // when watching for scripts on the blockchain. + required int64 creation_timestamp = 2; +} + message TransactionInput { // Hash of the transaction this input is using. required bytes transaction_out_point_hash = 1; @@ -257,6 +265,7 @@ message Wallet { repeated Key key = 3; repeated Transaction transaction = 4; + repeated Script watched_script = 15; optional EncryptionType encryption_type = 5 [default=UNENCRYPTED]; optional ScryptParameters encryption_parameters = 6; @@ -280,5 +289,5 @@ message Wallet { // can be used to recover a compromised wallet, or just as part of preventative defence-in-depth measures. optional uint64 key_rotation_time = 13; - // Next tag: 15 + // Next tag: 16 } diff --git a/core/src/main/java/com/google/bitcoin/core/AbstractWalletEventListener.java b/core/src/main/java/com/google/bitcoin/core/AbstractWalletEventListener.java index af7a5701..60cf24aa 100644 --- a/core/src/main/java/com/google/bitcoin/core/AbstractWalletEventListener.java +++ b/core/src/main/java/com/google/bitcoin/core/AbstractWalletEventListener.java @@ -16,6 +16,8 @@ package com.google.bitcoin.core; +import com.google.bitcoin.script.Script; + import java.math.BigInteger; import java.util.List; @@ -48,6 +50,11 @@ public abstract class AbstractWalletEventListener implements WalletEventListener onChange(); } + @Override + public void onScriptsAdded(Wallet wallet, List