Author

Topic: armoryd not broadcasting transactions (Read 990 times)

newbie
Activity: 10
Merit: 0
June 01, 2016, 04:51:13 AM
#17
OK, I will limit my use to the ledger as this seems to provide quite enough of info about the transactions.
Thanks for the support. Smiley
legendary
Activity: 3766
Merit: 1364
Armory Developer
https://github.com/goatpig/BitcoinArmory/blob/master/armoryengine/ArmoryUtils.py#L114

Try with this. It looks like one call returns ZC outputs while the other doesn't and it gets confused there. Most likely a bug. I'll to have look into it at some point.

newbie
Activity: 10
Merit: 0
Apparently, my problem is that this piece of code does not work as expected:
Code:
if spendBal < totalSend + fee:
         raise NotEnoughCoinsError, "You have %s satoshis which is not enough to send %s satoshis with a fee of %s."

The spendBal should be 0 and thus must have prevented the further creation of the transaction for publishing. Instead, somehow, this piece is skipped and the transaction gets created on an unconfirmed change. I'll try to investigate and fix it.

However, can you still tell me why I can't see a list of transactions which includes one ZC transaction? I mean, should I check the ledger first? And after the ledger shows there are no ZC transactions, only after that I will be able to see the full list of transactions? Is this a correct logic?
newbie
Activity: 10
Merit: 0
I checked the IGNOREZC. It's false by default. I can't see any enableZC parameter...

The wallet has only one receive transaction.

The send transactions I try to create have 2 + 1 outputs: 2 destination addresses + 1 for the change.
After the transaction is published, the whole wallet balance becomes this:
Code:
{
"unspent": 0.0003
"full": 0.0003
"ultimate": 0.0003
"unconf": 0
"spendable": 0
"total": 0.0003
"spend": 0
"unconfirmed": 0
}
legendary
Activity: 3766
Merit: 1364
Armory Developer
How many inputs do you have in the wallet? Are you trying to spend unconfirmed change? Did you create the ustx with enableZC = True?
newbie
Activity: 10
Merit: 0
OK, the new 0.94.1 version has the same problem.

After the first transaction is out, while it is unconfirmed, there is no way to send other transactions. In fact, the method create_unsigned_transaction returns
Code:
"Coin selection failed. This shouldn't happen."

This is the ledger extract:
Code:
{
        "amount": 0.0002,
        "blockhash": "",
        "blocktime": 0,
        "changerecip": "13EBMGZR1xvNM5q267CnVZuiGztYeRXrcK",
        "confirmations": -4294553343,
        "direction": "send",
        "fee": 0.0001,
        "firstrecip": "18koHPBzcdqcbZ7KJRHdzgb8We5GhDLUdN",
        "netdiff": -0.0003,
        "txid": "756a4b9c9bb871a876bb44cafd23c9263284db5cabbb0b05ba567b60dcc7385e",
        "txsize": 291,
        "txtime": 1464539257,
        "wallet": "2PbtaKW7"
    }


Any ideas on how to solve this problem?
newbie
Activity: 10
Merit: 0
I'll give it a try and let you know. Thanks.
legendary
Activity: 3766
Merit: 1364
Armory Developer
Do you think I should upgrade to 0.94 as this problem might have already been solved?

You should
newbie
Activity: 10
Merit: 0
May 27, 2016, 10:56:08 AM
#9
Yep, apparently, 0.93. I got it in March.

And another update. Apparently, the list transactions does not work with unconfirmed transactions. After my transactions got the confirmations, the ListTransactions command worked again.

Now I created another transaction and the transactions list is broken again: transaction list is unavailable, the transaction id can not be found etc. The GetLedger command works just fine, though.

So, I'm waiting for some time for the confirmations to arrive and will retry again and will let you know.

Do you think I should upgrade to 0.94 as this problem might have already been solved?
legendary
Activity: 3766
Merit: 1364
Armory Developer
May 27, 2016, 09:56:42 AM
#8
supernode? You using 0.93?
newbie
Activity: 10
Merit: 0
May 27, 2016, 08:47:34 AM
#7
I imported the wallet into the Armory GUI, restarted it and waited for it to rescan the db. But it does not find any transaction in this wallet. Actually, it says the wallet's balance is 0, while the armory daemon in the supernode mode shows correctly the balance.

I tested on 2 completely separated armory instances located on 2 different servers and having nothing in common.

Any other idea where to investigate?
newbie
Activity: 10
Merit: 0
May 27, 2016, 01:49:58 AM
#6
I'll check in the GUI version and let you know.

In the meantime, the code I use for creating and broadcasting the transaction is this:
Code:
# Destinations array
scriptValuePairs = []

# -- user destination (toAddress)
ustxScr = getScriptForUserString(toAddress, self.serverWltMap, self.convLBDictToList())
scriptValuePairs.append([ustxScr['Script'], JSONtoAmount(amount)])

# -- my destination (my primary address)
ustxScr = getScriptForUserString(primaryAddr, self.serverWltMap, self.convLBDictToList())
scriptValuePairs.append([ustxScr['Script'], JSONtoAmount(serviceFee)])

# Create unsigned transaction (self.curWlt is substituted by the wallet if a valid walletIDB58 is provided)
tran = self.create_unsigned_transaction(scriptValuePairs, wantfee=fee, walletIDB58=wltArmory.uniqueIDB58)

# Unserialize ascii transaction
ustxObj = UnsignedTransaction().unserializeAscii(tran)

# Unlock the source wallet to sign the transaction
try:
   crpPassphrase = SecureBinaryData(str(passphrase))
   wltArmory.unlock(securePassphrase=crpPassphrase,
                      tempKeyLifetime=int(5)) # unlock for 5 sec
finally:
   crpPassphrase.destroy() # Ensure SBD is destroyed.

# Sign transaction
signedTran = self.sign_transaction(ustxObj, walletIDB58=wltArmory.uniqueIDB58)
if signedTran:
   if not signedTran.verifySigsAllInputs():
      return {'error': 'Incomplete transaction. It needs more signatures.'}

   pytx = signedTran.getSignedPyTx()
   newTxHash = pytx.getHash()
   
   def sendGetDataMsg():
      msg = PyMessage('getdata')
      msg.payload.invList.append( [MSG_INV_TX, newTxHash] )
      self.NetworkingFactory.sendMessage(msg)
      LOGINFO('Sending transaction: ' + str(msg.pprint()))
   
   self.NetworkingFactory.sendTx(pytx)
   reactor.callLater(3, sendGetDataMsg)

These are bits of the original code from armoryd.py. Am I missing anything here?
legendary
Activity: 3766
Merit: 1364
Armory Developer
May 26, 2016, 01:01:53 PM
#5
Also, please double check these wallets on the GUI version.
legendary
Activity: 3766
Merit: 1364
Armory Developer
May 26, 2016, 11:37:51 AM
#4
Are you spending without change?
newbie
Activity: 10
Merit: 0
May 26, 2016, 08:57:49 AM
#3
I tried with a new wallet which has no transaction history.

Actually, the first transaction seems to have been broadcast successfully.

But it corrupts something in the transaction history section, so the LISTTRANSACTIONS command issues an error:
Code:
Traceback (most recent call last):
  File "/home/deployer/BitcoinArmory/armoryengine/Decorators.py", line 79, in inner
    rv = func(*args, **kwargs)
  File "/home/deployer/BitcoinArmory/armoryd.py", line 1844, in jsonrpc_listtransactions
    cppHead = TheBDM.bdv().getHeaderPtrForTx(cppTx)
  File "/home/deployer/BitcoinArmory/CppBlockUtils.py", line 2136, in getHeaderPtrForTx
    def getHeaderPtrForTx(self, *args): return _CppBlockUtils.BlockDataViewer_getHeaderPtrForTx(self, *args)
RuntimeError: TxRef in Tx object is not set, cannot get header ptr

Most probably, after this moment the wallet will not be able to broadcast transactions. I still need to confirm it, but this is my original problem and the previous wallets I used to do the checks had the same issue with the transaction list after the first successful broadcast.

What can be wrong? Can you help me investigate this issue?

Thanks.
legendary
Activity: 3766
Merit: 1364
Armory Developer
May 25, 2016, 05:20:18 PM
#2
I haven't tested this broadcasting code directly but it looks valid. You should figure out if the tx is valid at first. I suggest you look at your bitcoin node debug log to identify the error message attached with this tx. Once you have figured if the it's the tx that is off or the broadcasting code, we can figure out the next step.

newbie
Activity: 10
Merit: 0
May 25, 2016, 08:56:08 AM
#1
Hi there,

I've installed Armory on an Ubuntu server and changed armoryd a bit to respond to my needs:
 - added some methods
 - untied these methods from the current wallet (each method receives the wallet name to work with)

In particular, I created a method which handles the transaction creation and broadcasting for a given wallet.

It is composed of bits of:
 - CreateUsTxForMany
 - SignAsciiTransaction
 - SendAsciiTransaction

The last part, though, does not seem to work.
The following is the piece of code directly from armoryd.py:
Code:
pytx = signedTran.getSignedPyTx()
newTxHash = pytx.getHash()

def sendGetDataMsg():
msg = PyMessage('getdata')
msg.payload.invList.append( [MSG_INV_TX, newTxHash] )
self.NetworkingFactory.sendMessage(msg)
LOGINFO('Sending transaction: ' + str(msg.pprint()))
 
self.NetworkingFactory.sendTx(pytx)
reactor.callLater(3, sendGetDataMsg)
   
return {'data': pytx.getHashHex(BIGENDIAN)}

It returns the transaction hash, but does not publish the transaction itself.

I wonder where to start the investigation.

The armory error logs report that Armory fails to process the PyMessage from the LOGINFO part in sendGetDataMsg function. That always remains None.
The armory logs report the GETDATA message correctly:
Code:
Bitcoin-Network-Message -- GETDATA
   Magic:   f9beb4d9
   Command: getdata
   Payload: 37 bytes

   Message(getdata):
      TX   : 29a7f012b.....

But then I can see that Armory starts a side-scan of the totally irrelevant wallet (in fact, the Active Wallet which is ignored in this case):
Code:
-WARN  - 1464184077: (BDM_supportClasses.cpp:44) Updating SSH last scanned
-INFO  - 1464184077: (BDM_supportClasses.cpp:246) Done with side scan of wallet abcd...

Can you help me and guide where to look for the problem and how to force Armory to side scan my specific wallet and not the Active one?

Thanks in advance.
Jump to: