Jump to content

llTransferLindenDollars() - help needed to automate it


Estimated
 Share

You are about to reply to a thread that has been inactive for 4091 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Going by Kelly Lindens example, i need to know if failed transactions automatically get paid later or if i need to edit it and if so how would i do that and avoid "double spending",

list transactions;
 
// This is not a complete script and assumes PERMISSION_DEBIT has been granted.
default
{
    touch_start(integer n)
    {
        transactions += [llTransferLindenDollars(llDetectedKey(0),1),1,llDetectedKey(0)];
    }
     
    transaction_result(key id, integer success, string data)
    {
        integer i = llListFindList(transactions, id);
        if (i == -1)
        {
            // Unexpected transaction id!
            return;
        }
         
        // Extra data for this transaction
        integer amount = llList2Integer(transactions,i + 1);
        key recipient = llList2Key(transactions,i + 2);
         
        // Cleanup
        transactions = llDeleteSubList(transactions,i,i+2);
         
        if (success)
        {
            // Yay it succeeded
            llSay("Gave L$" + (string)amount + " to " + (string)recipient); 
        }
        else
        {
            // Boo it failed
            llSay("Error giving L$" + (string)amount + " to " + (string)recipient + ": " + data); 
        }
    }
}

I've tried in the past to use a simplier approach and put in if (!success) llTransferLindenDollars(towhoever,whateveramount); but that created double, triple spending.

 

Any help would be greatly appreciated, thank you.

 

Link to comment
Share on other sites

is the following implementation 100% proof against doublespending ?

list transactions;key userID;integer paymentamount = 1; default{    state_entry()    {        userID = llGetOwner();        llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);    }    touch_start(integer n)    {        transactions += [llTransferLindenDollars(userID,paymentamount),paymentamount,userID];    }    transaction_result(key id, integer success, string data)    {        integer i = llListFindList(transactions, id);        if (i == -1) return;        integer amount = llList2Integer(transactions,i + 1);        key recipient = llList2Key(transactions,i + 2);        transactions = llDeleteSubList(transactions,i,i+2);        if (!success)        {            // Boo it failed            llOwnerSay("Error giving L$" + (string)amount + " to " + (string)recipient + ": " + data);             transactions += [llTransferLindenDollars(recipient,amount),amount,recipient];        }    }}

 

Link to comment
Share on other sites

Hi, I have been working with llTransferLindenDollars a lot lately.  

My experience is there are very few reasons why the transfer will fail, once you have the Transaction ID, because if the SL payment server is up and running fine enough to give you the Transaction ID, it will complete the payment.   The most common reason why the payment would not becompleted is that the DEBIT PERMISSION was not granted or there is not enough money in the owner's account.   

So your logic in transaction_result does not make too much sense.  If the transaction fails once, chances are it will just fail again and again..   You are just setting up an endless loop.

Instead, send a message out to the owner of the script or anyone else who can fix the cause of the problem.

 

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the suggestions Malestorm, however having objects send me a message is just as useless as waiting for the person that didn't receive it to message me.

My objects handle about 30000-50000 transactions daily, some of them fail not because of debit perms nor insufficient funds, but due to SL not being able to handle the amount of transactions.

 

I need a framework that will auto-retry (maybe after a small delay) infinitely until it succeeds. Because doing it manually completely removes the point of the llTransferLindenDollars ERROR event. 

 

If someone would comment on the code above or give some ideas how to do it SAFELY, would be greatly appreciated. Thank you very much!

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4091 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...