Bugfix for Db0056: Comparison was always true
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Swarmops.Database
|
||||
/// </summary>
|
||||
public static int DbVersionExpected
|
||||
{
|
||||
get { return 56; }
|
||||
get { return 57; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,4 +53,5 @@
|
||||
0053 - Bugfix for 0052 [RF]
|
||||
0054 - Fix for Conditional-CreateUTXO procedure with fork in effect [RF]
|
||||
0055 - Fix for bug introduced with 0054, hash collisions in index [RF]
|
||||
0056 - Splitting a storedproc into two; debugging a weird multi-row select return [RF]
|
||||
0056 - Splitting a storedproc into two; debugging a weird multi-row select return [RF]
|
||||
0057 - Bugfix for 0056: case insensitivity caused always-true comparison w/o qualifier [RF]
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
DROP PROCEDURE IF EXISTS `CreateHotBitcoinAddressUnspentConditional`
|
||||
|
||||
#
|
||||
|
||||
|
||||
CREATE PROCEDURE `CreateHotBitcoinAddressUnspentConditional`(
|
||||
IN hotBitcoinAddressId INT,
|
||||
IN amountSatoshis BIGINT,
|
||||
IN transactionHash VARCHAR(128),
|
||||
IN transactionOutputIndex INT,
|
||||
IN confirmationCount INT
|
||||
)
|
||||
BEGIN
|
||||
|
||||
DECLARE unspentId INT;
|
||||
|
||||
IF ((SELECT COUNT(*) FROM HotBitcoinAddressUnspents
|
||||
WHERE HotBitcoinAddressUnspents.TransactionHash=transactionHash
|
||||
AND HotBitcoinAddressUnspents.TransactionOutputIndex=transactionOutputIndex
|
||||
AND HotBitcoinAddressUnspents.HotBitcoinAddressId=hotBitcoinAddressId) = 0)
|
||||
THEN
|
||||
|
||||
INSERT INTO HotBitcoinAddressUnspents
|
||||
(HotBitcoinAddressId,AmountSatoshis,TransactionHash,TransactionOutputIndex,ConfirmationCount)
|
||||
VALUES
|
||||
(hotBitcoinAddressId,amountSatoshis,transactionHash,transactionOutputIndex,confirmationCount);
|
||||
|
||||
SELECT LAST_INSERT_ID() AS Identity;
|
||||
|
||||
ELSE
|
||||
|
||||
SELECT HotBitcoinAddressUnspents.HotBitcoinAddressUnspentId INTO unspentId
|
||||
FROM HotBitcoinAddressUnspents
|
||||
WHERE HotBitcoinAddressUnspents.TransactionHash=transactionHash
|
||||
AND HotBitcoinAddressUnspents.TransactionOutputIndex=transactionOutputIndex
|
||||
AND HotBitcoinAddressUnspents.HotBitcoinAddressId=hotBitcoinAddressId;
|
||||
|
||||
UPDATE HotBitcoinAddressUnspents
|
||||
SET HotBitcoinAddressUnspents.ConfirmationCount=confirmationCount
|
||||
WHERE HotBitcoinAddressUnspents.HotBitcoinAddressUnspentId=unspentId;
|
||||
|
||||
SELECT -unspentId AS Identity;
|
||||
|
||||
END IF;
|
||||
|
||||
END
|
||||
|
||||
@@ -26,8 +26,6 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
if (address.Chain == BitcoinChain.Core)
|
||||
{
|
||||
// These shouldn't exist much, so make sure that we have the equivalent Cash address registered
|
||||
BitcoinUtility.TestUnspents(BitcoinChain.Cash, address.Address);
|
||||
|
||||
try
|
||||
{
|
||||
HotBitcoinAddress.FromAddress(BitcoinChain.Cash, address.Address);
|
||||
|
||||
Reference in New Issue
Block a user