From 6b95012d1f13194aed665b793565caea68104065 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Sun, 29 Nov 2015 11:25:32 +0100 Subject: [PATCH] wallet.proto: Add IN_CONFLICT transaction confidence state. --- .../main/java/org/bitcoinj/wallet/Protos.java | 114 ++++++++++-------- core/src/wallet.proto | 4 +- 2 files changed, 68 insertions(+), 50 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/wallet/Protos.java b/core/src/main/java/org/bitcoinj/wallet/Protos.java index cf6116b1..7c7d3f2a 100644 --- a/core/src/main/java/org/bitcoinj/wallet/Protos.java +++ b/core/src/main/java/org/bitcoinj/wallet/Protos.java @@ -6732,6 +6732,10 @@ public final class Protos { implements com.google.protobuf.ProtocolMessageEnum { /** * UNKNOWN = 0; + * + *
+       * See TransactionConfidence.java for a more thorough explanation of these types.
+       * 
*/ UNKNOWN(0, 0), /** @@ -6762,7 +6766,7 @@ public final class Protos { * DEAD = 4; * *
-       * Either if overriding_transaction is present or transaction is dead coinbase
+       * Either if overriding_transaction is present or transaction is dead coinbase.
        * 
*/ DEAD(4, 4), @@ -6778,6 +6782,10 @@ public final class Protos { /** * UNKNOWN = 0; + * + *
+       * See TransactionConfidence.java for a more thorough explanation of these types.
+       * 
*/ public static final int UNKNOWN_VALUE = 0; /** @@ -6808,10 +6816,18 @@ public final class Protos { * DEAD = 4; * *
-       * Either if overriding_transaction is present or transaction is dead coinbase
+       * Either if overriding_transaction is present or transaction is dead coinbase.
        * 
*/ public static final int DEAD_VALUE = 4; + /** + * IN_CONFLICT = 5; + * + *
+       * There is another transaction spending one of this transaction inputs.
+       * 
+ */ + public static final int IN_CONFLICT_VALUE = 5; public final int getNumber() { return value; } @@ -18895,59 +18911,59 @@ public final class Protos { "\030\004 \001(\r\022\r\n\005value\030\005 \001(\003\"\177\n\021TransactionOutp" + "ut\022\r\n\005value\030\001 \002(\003\022\024\n\014script_bytes\030\002 \002(\014\022" + "!\n\031spent_by_transaction_hash\030\003 \001(\014\022\"\n\032sp" + - "ent_by_transaction_index\030\004 \001(\005\"\211\003\n\025Trans" + + "ent_by_transaction_index\030\004 \001(\005\"\232\003\n\025Trans" + "actionConfidence\0220\n\004type\030\001 \001(\0162\".wallet." + "TransactionConfidence.Type\022\032\n\022appeared_a" + "t_height\030\002 \001(\005\022\036\n\026overriding_transaction", "\030\003 \001(\014\022\r\n\005depth\030\004 \001(\005\022)\n\014broadcast_by\030\006 " + "\003(\0132\023.wallet.PeerAddress\0224\n\006source\030\007 \001(\016" + - "2$.wallet.TransactionConfidence.Source\"O" + + "2$.wallet.TransactionConfidence.Source\"`" + "\n\004Type\022\013\n\007UNKNOWN\020\000\022\014\n\010BUILDING\020\001\022\013\n\007PEN" + - "DING\020\002\022\025\n\021NOT_IN_BEST_CHAIN\020\003\022\010\n\004DEAD\020\004\"" + - "A\n\006Source\022\022\n\016SOURCE_UNKNOWN\020\000\022\022\n\016SOURCE_" + - "NETWORK\020\001\022\017\n\013SOURCE_SELF\020\002\"\303\005\n\013Transacti" + - "on\022\017\n\007version\030\001 \002(\005\022\014\n\004hash\030\002 \002(\014\022&\n\004poo" + - "l\030\003 \001(\0162\030.wallet.Transaction.Pool\022\021\n\tloc" + - "k_time\030\004 \001(\r\022\022\n\nupdated_at\030\005 \001(\003\0223\n\021tran", - "saction_input\030\006 \003(\0132\030.wallet.Transaction" + - "Input\0225\n\022transaction_output\030\007 \003(\0132\031.wall" + - "et.TransactionOutput\022\022\n\nblock_hash\030\010 \003(\014" + - "\022 \n\030block_relativity_offsets\030\013 \003(\005\0221\n\nco" + - "nfidence\030\t \001(\0132\035.wallet.TransactionConfi" + - "dence\0225\n\007purpose\030\n \001(\0162\033.wallet.Transact" + - "ion.Purpose:\007UNKNOWN\022+\n\rexchange_rate\030\014 " + - "\001(\0132\024.wallet.ExchangeRate\022\014\n\004memo\030\r \001(\t\"" + - "Y\n\004Pool\022\013\n\007UNSPENT\020\004\022\t\n\005SPENT\020\005\022\014\n\010INACT" + - "IVE\020\002\022\010\n\004DEAD\020\n\022\013\n\007PENDING\020\020\022\024\n\020PENDING_", - "INACTIVE\020\022\"\243\001\n\007Purpose\022\013\n\007UNKNOWN\020\000\022\020\n\014U" + - "SER_PAYMENT\020\001\022\020\n\014KEY_ROTATION\020\002\022\034\n\030ASSUR" + - "ANCE_CONTRACT_CLAIM\020\003\022\035\n\031ASSURANCE_CONTR" + - "ACT_PLEDGE\020\004\022\033\n\027ASSURANCE_CONTRACT_STUB\020" + - "\005\022\r\n\tRAISE_FEE\020\006\"N\n\020ScryptParameters\022\014\n\004" + - "salt\030\001 \002(\014\022\020\n\001n\030\002 \001(\003:\00516384\022\014\n\001r\030\003 \001(\005:" + - "\0018\022\014\n\001p\030\004 \001(\005:\0011\"8\n\tExtension\022\n\n\002id\030\001 \002(" + - "\t\022\014\n\004data\030\002 \002(\014\022\021\n\tmandatory\030\003 \002(\010\" \n\003Ta" + - "g\022\013\n\003tag\030\001 \002(\t\022\014\n\004data\030\002 \002(\014\"5\n\021Transact" + - "ionSigner\022\022\n\nclass_name\030\001 \002(\t\022\014\n\004data\030\002 ", - "\001(\014\"\351\004\n\006Wallet\022\032\n\022network_identifier\030\001 \002" + - "(\t\022\034\n\024last_seen_block_hash\030\002 \001(\014\022\036\n\026last" + - "_seen_block_height\030\014 \001(\r\022!\n\031last_seen_bl" + - "ock_time_secs\030\016 \001(\003\022\030\n\003key\030\003 \003(\0132\013.walle" + - "t.Key\022(\n\013transaction\030\004 \003(\0132\023.wallet.Tran" + - "saction\022&\n\016watched_script\030\017 \003(\0132\016.wallet" + - ".Script\022C\n\017encryption_type\030\005 \001(\0162\035.walle" + - "t.Wallet.EncryptionType:\013UNENCRYPTED\0227\n\025" + - "encryption_parameters\030\006 \001(\0132\030.wallet.Scr" + - "yptParameters\022\022\n\007version\030\007 \001(\005:\0011\022$\n\text", - "ension\030\n \003(\0132\021.wallet.Extension\022\023\n\013descr" + - "iption\030\013 \001(\t\022\031\n\021key_rotation_time\030\r \001(\004\022" + - "\031\n\004tags\030\020 \003(\0132\013.wallet.Tag\0226\n\023transactio" + - "n_signers\030\021 \003(\0132\031.wallet.TransactionSign" + - "er\";\n\016EncryptionType\022\017\n\013UNENCRYPTED\020\001\022\030\n" + - "\024ENCRYPTED_SCRYPT_AES\020\002\"R\n\014ExchangeRate\022" + - "\022\n\ncoin_value\030\001 \002(\003\022\022\n\nfiat_value\030\002 \002(\003\022" + - "\032\n\022fiat_currency_code\030\003 \002(\tB\035\n\023org.bitco" + - "inj.walletB\006Protos" + "DING\020\002\022\025\n\021NOT_IN_BEST_CHAIN\020\003\022\010\n\004DEAD\020\004\022" + + "\017\n\013IN_CONFLICT\020\005\"A\n\006Source\022\022\n\016SOURCE_UNK" + + "NOWN\020\000\022\022\n\016SOURCE_NETWORK\020\001\022\017\n\013SOURCE_SEL" + + "F\020\002\"\303\005\n\013Transaction\022\017\n\007version\030\001 \002(\005\022\014\n\004" + + "hash\030\002 \002(\014\022&\n\004pool\030\003 \001(\0162\030.wallet.Transa" + + "ction.Pool\022\021\n\tlock_time\030\004 \001(\r\022\022\n\nupdated", + "_at\030\005 \001(\003\0223\n\021transaction_input\030\006 \003(\0132\030.w" + + "allet.TransactionInput\0225\n\022transaction_ou" + + "tput\030\007 \003(\0132\031.wallet.TransactionOutput\022\022\n" + + "\nblock_hash\030\010 \003(\014\022 \n\030block_relativity_of" + + "fsets\030\013 \003(\005\0221\n\nconfidence\030\t \001(\0132\035.wallet" + + ".TransactionConfidence\0225\n\007purpose\030\n \001(\0162" + + "\033.wallet.Transaction.Purpose:\007UNKNOWN\022+\n" + + "\rexchange_rate\030\014 \001(\0132\024.wallet.ExchangeRa" + + "te\022\014\n\004memo\030\r \001(\t\"Y\n\004Pool\022\013\n\007UNSPENT\020\004\022\t\n" + + "\005SPENT\020\005\022\014\n\010INACTIVE\020\002\022\010\n\004DEAD\020\n\022\013\n\007PEND", + "ING\020\020\022\024\n\020PENDING_INACTIVE\020\022\"\243\001\n\007Purpose\022" + + "\013\n\007UNKNOWN\020\000\022\020\n\014USER_PAYMENT\020\001\022\020\n\014KEY_RO" + + "TATION\020\002\022\034\n\030ASSURANCE_CONTRACT_CLAIM\020\003\022\035" + + "\n\031ASSURANCE_CONTRACT_PLEDGE\020\004\022\033\n\027ASSURAN" + + "CE_CONTRACT_STUB\020\005\022\r\n\tRAISE_FEE\020\006\"N\n\020Scr" + + "yptParameters\022\014\n\004salt\030\001 \002(\014\022\020\n\001n\030\002 \001(\003:\005" + + "16384\022\014\n\001r\030\003 \001(\005:\0018\022\014\n\001p\030\004 \001(\005:\0011\"8\n\tExt" + + "ension\022\n\n\002id\030\001 \002(\t\022\014\n\004data\030\002 \002(\014\022\021\n\tmand" + + "atory\030\003 \002(\010\" \n\003Tag\022\013\n\003tag\030\001 \002(\t\022\014\n\004data\030" + + "\002 \002(\014\"5\n\021TransactionSigner\022\022\n\nclass_name", + "\030\001 \002(\t\022\014\n\004data\030\002 \001(\014\"\351\004\n\006Wallet\022\032\n\022netwo" + + "rk_identifier\030\001 \002(\t\022\034\n\024last_seen_block_h" + + "ash\030\002 \001(\014\022\036\n\026last_seen_block_height\030\014 \001(" + + "\r\022!\n\031last_seen_block_time_secs\030\016 \001(\003\022\030\n\003" + + "key\030\003 \003(\0132\013.wallet.Key\022(\n\013transaction\030\004 " + + "\003(\0132\023.wallet.Transaction\022&\n\016watched_scri" + + "pt\030\017 \003(\0132\016.wallet.Script\022C\n\017encryption_t" + + "ype\030\005 \001(\0162\035.wallet.Wallet.EncryptionType" + + ":\013UNENCRYPTED\0227\n\025encryption_parameters\030\006" + + " \001(\0132\030.wallet.ScryptParameters\022\022\n\007versio", + "n\030\007 \001(\005:\0011\022$\n\textension\030\n \003(\0132\021.wallet.E" + + "xtension\022\023\n\013description\030\013 \001(\t\022\031\n\021key_rot" + + "ation_time\030\r \001(\004\022\031\n\004tags\030\020 \003(\0132\013.wallet." + + "Tag\0226\n\023transaction_signers\030\021 \003(\0132\031.walle" + + "t.TransactionSigner\";\n\016EncryptionType\022\017\n" + + "\013UNENCRYPTED\020\001\022\030\n\024ENCRYPTED_SCRYPT_AES\020\002" + + "\"R\n\014ExchangeRate\022\022\n\ncoin_value\030\001 \002(\003\022\022\n\n" + + "fiat_value\030\002 \002(\003\022\032\n\022fiat_currency_code\030\003" + + " \002(\tB\035\n\023org.bitcoinj.walletB\006Protos" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { diff --git a/core/src/wallet.proto b/core/src/wallet.proto index ae6baf3d..6529fde9 100644 --- a/core/src/wallet.proto +++ b/core/src/wallet.proto @@ -172,11 +172,13 @@ message TransactionOutput { */ message TransactionConfidence { enum Type { + // See TransactionConfidence.java for a more thorough explanation of these types. UNKNOWN = 0; BUILDING = 1; // In best chain. If and only if appeared_at_height is present. PENDING = 2; // Unconfirmed and sitting in the networks memory pools, waiting to be included in the chain. NOT_IN_BEST_CHAIN = 3; // Deprecated: equivalent to PENDING. - DEAD = 4; // Either if overriding_transaction is present or transaction is dead coinbase + DEAD = 4; // Either if overriding_transaction is present or transaction is dead coinbase. + IN_CONFLICT = 5; // There is another transaction spending one of this transaction inputs. } // This is optional in case we add confidence types to prevent parse errors - backwards compatible.