From 76071d8378f708f7e2f966a50c45976f1f1b4f69 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Fri, 29 Nov 2019 11:36:56 +0100 Subject: [PATCH] DatabaseFullPrunedBlockStore implementations: Make sure SegWit addresses fit into the openoutputs.toaddress column. --- .../main/java/org/bitcoinj/store/H2FullPrunedBlockStore.java | 5 +++-- .../java/org/bitcoinj/store/MySQLFullPrunedBlockStore.java | 3 ++- .../org/bitcoinj/store/PostgresFullPrunedBlockStore.java | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/store/H2FullPrunedBlockStore.java b/core/src/main/java/org/bitcoinj/store/H2FullPrunedBlockStore.java index 5a2453795..5c18e0bcb 100644 --- a/core/src/main/java/org/bitcoinj/store/H2FullPrunedBlockStore.java +++ b/core/src/main/java/org/bitcoinj/store/H2FullPrunedBlockStore.java @@ -1,6 +1,7 @@ /* * Copyright 2012 Matt Corallo. * Copyright 2014 Kalpesh Parmar. + * Copyright 2019 Andreas Schildbach * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,7 +66,7 @@ public class H2FullPrunedBlockStore extends DatabaseFullPrunedBlockStore { + "height INT NOT NULL," + "value BIGINT NOT NULL," + "scriptbytes BLOB NOT NULL," - + "toaddress VARCHAR(35)," + + "toaddress VARCHAR(74)," + "addresstargetable TINYINT," + "coinbase BOOLEAN," + "PRIMARY KEY (hash, index)," @@ -162,4 +163,4 @@ public class H2FullPrunedBlockStore extends DatabaseFullPrunedBlockStore { protected String getDatabaseDriverClass() { return DATABASE_DRIVER_CLASS; } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/bitcoinj/store/MySQLFullPrunedBlockStore.java b/core/src/main/java/org/bitcoinj/store/MySQLFullPrunedBlockStore.java index a79729c2a..c7cd5600c 100644 --- a/core/src/main/java/org/bitcoinj/store/MySQLFullPrunedBlockStore.java +++ b/core/src/main/java/org/bitcoinj/store/MySQLFullPrunedBlockStore.java @@ -1,5 +1,6 @@ /* * Copyright 2014 Kalpesh Parmar + * Copyright 2019 Andreas Schildbach * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +64,7 @@ public class MySQLFullPrunedBlockStore extends DatabaseFullPrunedBlockStore { " height integer NOT NULL,\n" + " value bigint NOT NULL,\n" + " scriptbytes mediumblob NOT NULL,\n" + - " toaddress varchar(35),\n" + + " toaddress varchar(74),\n" + " addresstargetable tinyint(1),\n" + " coinbase boolean,\n" + " CONSTRAINT openoutputs_pk PRIMARY KEY (hash, `index`) USING BTREE \n" + diff --git a/core/src/main/java/org/bitcoinj/store/PostgresFullPrunedBlockStore.java b/core/src/main/java/org/bitcoinj/store/PostgresFullPrunedBlockStore.java index 60d48d006..2907c5333 100644 --- a/core/src/main/java/org/bitcoinj/store/PostgresFullPrunedBlockStore.java +++ b/core/src/main/java/org/bitcoinj/store/PostgresFullPrunedBlockStore.java @@ -74,7 +74,7 @@ public class PostgresFullPrunedBlockStore extends DatabaseFullPrunedBlockStore { " height integer NOT NULL,\n" + " value bigint NOT NULL,\n" + " scriptbytes bytea NOT NULL,\n" + - " toaddress character varying(35),\n" + + " toaddress character varying(74),\n" + " addresstargetable smallint,\n" + " coinbase boolean,\n" + " CONSTRAINT openoutputs_pk PRIMARY KEY (hash,index)\n" + @@ -255,4 +255,4 @@ public class PostgresFullPrunedBlockStore extends DatabaseFullPrunedBlockStore { } } -} \ No newline at end of file +}