diff --git a/server/app/com/xsn/explorer/data/anorm/dao/TransactionInputPostgresDAO.scala b/server/app/com/xsn/explorer/data/anorm/dao/TransactionInputPostgresDAO.scala index 2f91395..811a998 100644 --- a/server/app/com/xsn/explorer/data/anorm/dao/TransactionInputPostgresDAO.scala +++ b/server/app/com/xsn/explorer/data/anorm/dao/TransactionInputPostgresDAO.scala @@ -35,7 +35,7 @@ class TransactionInputPostgresDAO { |INSERT INTO transaction_inputs | (txid, index, from_txid, from_output_index, value, addresses) |VALUES - | ({txid}, {index}, {from_txid}, {from_output_index}, {value}, ARRAY[{addresses}]) + | ({txid}, {index}, {from_txid}, {from_output_index}, {value}, ARRAY[{addresses}]::TEXT[]) """.stripMargin, params.head, params.tail: _* diff --git a/server/app/com/xsn/explorer/data/anorm/dao/TransactionOutputPostgresDAO.scala b/server/app/com/xsn/explorer/data/anorm/dao/TransactionOutputPostgresDAO.scala index 51fdcbc..2fc3aca 100644 --- a/server/app/com/xsn/explorer/data/anorm/dao/TransactionOutputPostgresDAO.scala +++ b/server/app/com/xsn/explorer/data/anorm/dao/TransactionOutputPostgresDAO.scala @@ -61,7 +61,7 @@ class TransactionOutputPostgresDAO { |INSERT INTO transaction_outputs | (txid, index, value, addresses, hex_script) |VALUES - | ({txid}, {index}, {value}, ARRAY[{addresses}], {hex_script}) + | ({txid}, {index}, {value}, ARRAY[{addresses}]::TEXT[], {hex_script}) """.stripMargin, params.head, params.tail: _* diff --git a/server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala b/server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala index c19413d..703b8ad 100644 --- a/server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala +++ b/server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala @@ -52,6 +52,19 @@ class TransactionPostgresDataHandlerSpec extends PostgresDataHandlerSpec with Be result mustEqual Good(expected) } + "find no results - no address involved" in { + val tx = transaction.copy( + inputs = transaction.inputs.map(_.copy(addresses = List.empty)), + outputs = transaction.outputs.map(_.copy(addresses = List.empty)) + ) + upsertTransaction(tx) + + val expected = PaginatedResult(query.offset, query.limit, Count(0), List.empty) + val result = dataHandler.getBy(randomAddress, query, defaultOrdering) + + result mustEqual Good(expected) + } + "find the right values" in { upsertTransaction(transaction)