XRPLF / rippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
https://xrpl.org
ISC License
4.54k stars 1.47k forks source link

error: txnNotFound #2828

Closed tudoanh closed 5 years ago

tudoanh commented 5 years ago

Hello guys, I have a problem with rippled server. It's weird and I can not figure it out why and how to fix it, so I need your help.

My case: When I use 'tx' command to get transaction information, some time I succeed and got the info I need, but some time I can't. Example:

In [107]: RippleAdapter.get_tx_info('0A139EAE67DABF4A9A6B6EE0786C48C0204F165B6D852B7E378C4AF803B2F0C7')
Out[107]: 
{'Account': 'rEvJT7U9z1QjnKDPYdsJysdVYeW1LA1aoD',
 'Amount': '100000000',
 'Destination': 'rKmkQk5qRTNSVKhAQ1CwXHhWYAte4yzS5L',
 'Fee': '10',
 'Flags': 2147483648,
 'Sequence': 11,
 'SigningPubKey': '032B271A63E6EF23451913135478C40B31257F4CF1057D7BE89B51DE438F02C3CA',
 'TransactionType': 'Payment',
 'TxnSignature': '304402201AE7C2E7F819940D81F82097D9ADCBF7434123F9788415E9F2405E6E48E5A8690220677160EA442A1A4084B96B47656C2853E2A0D5B5BC12FB1B0EFE749FBCE14AB6',
 'date': 601191302,
 'hash': '0A139EAE67DABF4A9A6B6EE0786C48C0204F165B6D852B7E378C4AF803B2F0C7',
 'inLedger': 16210842,
 'ledger_index': 16210842,
 'meta': {'AffectedNodes': [{'ModifiedNode': {'FinalFields': {'Account': 'rEvJT7U9z1QjnKDPYdsJysdVYeW1LA1aoD',
      'Balance': '23989999890',
      'Flags': 131072,
      'OwnerCount': 0,
      'Sequence': 12},
     'LedgerEntryType': 'AccountRoot',
     'LedgerIndex': '24EEE7CB00761F72CD32CF5A24C994362AE749595C83745C29E5D09B49F44501',
     'PreviousFields': {'Balance': '24089999900', 'Sequence': 11},
     'PreviousTxnID': '2FE9EDDABE07E6F0A37B6CA59543D909F100DA8811C01D4F4A9FB0FD90952D97',
     'PreviousTxnLgrSeq': 16210781}},
   {'CreatedNode': {'LedgerEntryType': 'AccountRoot',
     'LedgerIndex': 'E3680FB62071EC02926C729FDCA3505FFA85147AA639FB6B7F96B8E9601FFD31',
     'NewFields': {'Account': 'rKmkQk5qRTNSVKhAQ1CwXHhWYAte4yzS5L',
      'Balance': '100000000',
      'Sequence': 1}}}],
  'TransactionIndex': 0,
  'TransactionResult': 'tesSUCCESS',
  'delivered_amount': '100000000'},
 'status': 'success',
 'validated': True}

In [108]: RippleAdapter.get_tx_info('A7A5962CB0CC91007DADC3F4F74382A10B1FECA204EEA6A5834BA5A11E6097D7')
Out[108]: 
{'error': 'txnNotFound',
 'error_code': 29,
 'error_message': 'Transaction not found.',
 'request': {'binary': False,
  'command': 'tx',
  'transaction': 'A7A5962CB0CC91007DADC3F4F74382A10B1FECA204EEA6A5834BA5A11E6097D7'},
 'status': 'error'}

But that transaction is succeed, and I can see it at http://ripplerm.github.io/ripple-wallet/ I tried to ledger_request command with the ledger_id from that transaction, and it's worked, but I can not do that every time I need to get info for my user's transaction. So clearly it not the solution I need.

I'm using Testnet for development, and this is my config:

[server]
port_rpc_admin_local
port_peer
port_ws_admin_local
#port_ws_public
#ssl_key = /etc/ssl/private/server.key
#ssl_cert = /etc/ssl/certs/server.crt

[port_rpc_admin_local]
port = 5005
ip = 0.0.0.0
admin = 0.0.0.0
protocol = http

[port_peer]
port = 51235
ip = 0.0.0.0
admin = 0.0.0.0
protocol = peer

[port_ws_admin_local]
port = 6006
ip = 0.0.0.0
admin = 0.0.0.0
protocol = ws

#[port_ws_public]
#port = 5005
#ip = 127.0.0.1
#protocol = wss

#-------------------------------------------------------------------------------

[node_size]
small

# This is primary persistent datastore for rippled.  This includes transaction
# metadata, account states, and ledger headers.  Helpful information can be
# found here: https://ripple.com/wiki/NodeBackEnd
# delete old ledgers while maintaining at least 2000. Do not require an
# external administrative command to initiate deletion.
[node_db]
type=RocksDB
path=/var/lib/rippled/db/rocksdb
open_files=2000
filter_bits=12
cache_mb=256
file_size_mb=8
file_size_mult=2
online_delete=25000
advisory_delete=0

# This is the persistent datastore for shards. It is important for the health
# of the ripple network that rippled operators shard as much as practical.
# NuDB requires SSD storage. Helpful information can be found here
# https://ripple.com/build/history-sharding
# [shard_db]
# type=NuDB
# path=/var/lib/rippled/db/shards/nudb
# max_size_gb=30

[database_path]
/var/lib/rippled/db

# This needs to be an absolute directory reference, not a relative one.
# Modify this value as required.
[debug_logfile]
/var/log/rippled/debug.log

[sntp_servers]
time.windows.com
time.apple.com
time.nist.gov
pool.ntp.org

# Where to find some other servers speaking the Ripple protocol.
[ips]
s.altnet.rippletest.net 51234
r.altnet.rippletest.net 51235
r.altnet.rippletest.net 51233
r.altnet.rippletest.net 51234
# r.ripple.com 51235

# To use the XRP test network (see https://ripple.com/build/xrp-test-net/),
# use the following [ips] section instead:
# [ips]
# r.altnet.rippletest.net 51235

# File containing trusted validator keys or validator list publishers.
# Unless an absolute path is specified, it will be considered relative to the
# folder in which the rippled.cfg file is located.
[validators_file]
validators.txt

[ledger_history]
25000

# Turn down default logging to save disk space in the long run.
# Valid values here are trace, debug, info, warning, error, and fatal
[rpc_startup]
{ "command": "log_level", "severity": "warning" }

# If ssl_verify is 1, certificates will be validated.
# To allow the use of self-signed certificates for development or internal use,
# set to ssl_verify to 0.
[ssl_verify]
1

And the response from "server_state" command:

{'state': {'build_version': '1.1.2',
  'complete_ledgers': '16192468-16218092',
  'io_latency_ms': 1,
  'jq_trans_overflow': '0',
  'last_close': {'converge_time': 2000, 'proposers': 16},
  'load': {'job_types': [{'job_type': 'untrustedValidation', 'per_second': 4},
    {'job_type': 'ledgerRequest', 'per_second': 4},
    {'job_type': 'ledgerData', 'per_second': 1},
    {'in_progress': 1, 'job_type': 'clientCommand'},
    {'job_type': 'advanceLedger', 'per_second': 1},
    {'job_type': 'trustedValidation', 'per_second': 3},
    {'job_type': 'writeObjects', 'per_second': 5},
    {'job_type': 'trustedProposal', 'per_second': 4},
    {'job_type': 'peerCommand', 'per_second': 563},
    {'job_type': 'diskAccess', 'per_second': 3},
    {'job_type': 'WriteNode', 'per_second': 3}],
   'threads': 4},
  'load_base': 256,
  'load_factor': 256,
  'load_factor_fee_escalation': 256,
  'load_factor_fee_queue': 256,
  'load_factor_fee_reference': 256,
  'load_factor_server': 256,
  'peer_disconnects': '17',
  'peer_disconnects_resources': '0',
  'peers': 21,
  'pubkey_node': 'n9MSCkgZ4t66NopP5WPVAvAmAxTdwVJfVPXZzArR4VJGBQE6iUvU',
  'pubkey_validator': 'none',
  'server_state': 'full',
  'state_accounting': {'connected': {'duration_us': '75031848',
    'transitions': 1},
   'disconnected': {'duration_us': '1452439', 'transitions': 1},
   'full': {'duration_us': '3222055427', 'transitions': 1},
   'syncing': {'duration_us': '5005946', 'transitions': 1},
   'tracking': {'duration_us': '1', 'transitions': 1}},
  'time': '2019-Jan-19 11:42:10.248401',
  'uptime': 3303,
  'validated_ledger': {'base_fee': 10,
   'close_time': 601213330,
   'hash': '0A5C216C9B942262219C125F165EC92456816BDC86873BA58A6CBCF9744CC170',
   'reserve_base': 20000000,
   'reserve_inc': 5000000,
   'seq': 16218092},
  'validation_quorum': 13,
  'validator_list_expires': 601603200},
 'status': 'success'}

Thanks a lot.

nbougalis commented 5 years ago

This issue doesn't really contain enough information to help troubleshoot the issue. Does repeating the query at a later time succeed?

tudoanh commented 5 years ago

Yes, and it keep happened. Now i'm using Ripple Public server (s2.ripple.com) to get transaction info. https://developers.ripple.com/get-started-with-the-rippled-api.html

tudoanh commented 5 years ago

Seem like I have some mistake when config mainnet and testnet.