handle case where purse was already deleted on merge
This commit is contained in:
parent
1e7e0058e8
commit
f864d66d93
@ -62,6 +62,10 @@ THEN
|
|||||||
RETURN;
|
RETURN;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
-- Delete contract associated with purse, if it exists.
|
||||||
|
DELETE FROM contracts
|
||||||
|
WHERE purse_pub=in_purse_pub;
|
||||||
|
|
||||||
-- store purse decision
|
-- store purse decision
|
||||||
INSERT INTO purse_decision
|
INSERT INTO purse_decision
|
||||||
(purse_pub
|
(purse_pub
|
||||||
|
@ -42,6 +42,7 @@ DECLARE
|
|||||||
my_in_reserve_quota BOOLEAN;
|
my_in_reserve_quota BOOLEAN;
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF in_partner_url IS NULL
|
IF in_partner_url IS NULL
|
||||||
THEN
|
THEN
|
||||||
my_partner_serial_id=NULL;
|
my_partner_serial_id=NULL;
|
||||||
@ -124,6 +125,27 @@ THEN
|
|||||||
out_conflict=FALSE;
|
out_conflict=FALSE;
|
||||||
RETURN;
|
RETURN;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|
||||||
|
-- Remember how this purse was finished. This will conflict
|
||||||
|
-- if the purse was already decided previously.
|
||||||
|
INSERT INTO purse_decision
|
||||||
|
(purse_pub
|
||||||
|
,action_timestamp
|
||||||
|
,refunded)
|
||||||
|
VALUES
|
||||||
|
(in_purse_pub
|
||||||
|
,in_merge_timestamp
|
||||||
|
,FALSE)
|
||||||
|
ON CONFLICT DO NOTHING;
|
||||||
|
|
||||||
|
IF NOT FOUND
|
||||||
|
THEN
|
||||||
|
-- Purse was already decided (possibly deleted or merged differently).
|
||||||
|
out_conflict=TRUE;
|
||||||
|
RETURN;
|
||||||
|
END IF;
|
||||||
|
|
||||||
out_conflict=FALSE;
|
out_conflict=FALSE;
|
||||||
|
|
||||||
|
|
||||||
@ -138,15 +160,6 @@ INSERT INTO reserves
|
|||||||
,in_expiration_date)
|
,in_expiration_date)
|
||||||
ON CONFLICT DO NOTHING;
|
ON CONFLICT DO NOTHING;
|
||||||
|
|
||||||
-- Remember how this purse was finished.
|
|
||||||
INSERT INTO purse_decision
|
|
||||||
(purse_pub
|
|
||||||
,action_timestamp
|
|
||||||
,refunded)
|
|
||||||
VALUES
|
|
||||||
(in_purse_pub
|
|
||||||
,in_merge_timestamp
|
|
||||||
,FALSE);
|
|
||||||
|
|
||||||
IF (my_in_reserve_quota)
|
IF (my_in_reserve_quota)
|
||||||
THEN
|
THEN
|
||||||
|
Loading…
Reference in New Issue
Block a user