decred / dcrtime

Decred anchored timestamp client, proxy, and server.
ISC License
28 stars 23 forks source link

Testnet server is not anchoring or storing files #42

Closed fernandoabolafio closed 4 years ago

fernandoabolafio commented 5 years ago

I've tested with multiple files to make sure the files aren't being anchored:

Steps (through dcrtime cmd):

  1. Submit a file for the testnet server -> Response says the file digest will be successful uploaded ✅
  2. Try to submit the same file again -> Response says the file digest already exists ✅
  3. Wait until the next hourly anchor (e.g the beginning of the next hour) ✅
  4. Submit the same file again -> The server will wrongly notify that the file digest was correclty uploaded ❗️ ❗️ Expected: Same result as 2: The server will correctly notify that the server already exists
devwarrior777 commented 5 years ago

Hi ... is this still a problem on testnet?

amass01 commented 4 years ago

I was able to reproduce this behavior with my local dcrtimed. The issue is related to how we handle anchoring transactions confirmations:

I had dcrd down, dcrwallet failed to publish transactions on anchoring, and then i was able to re-stamp the same file:

$ dcrtime -skipverify -h=localhost -testnet ./README.md                                          [1:14:49]
f5a20a470d04a05ab488365f7a8f1e5763a98abeef18b15589b525006d275eaf OK ./README.md

$ dcrtime -skipverify -h=localhost -testnet ./README.md                                          [1:14:56]
f5a20a470d04a05ab488365f7a8f1e5763a98abeef18b15589b525006d275eaf OK ./README.md

$ dcrtime -skipverify -h=localhost -testnet ./README.md                                          [1:15:50]
f5a20a470d04a05ab488365f7a8f1e5763a98abeef18b15589b525006d275eaf OK ./README.md

I've noticed couple of things: when transaction publishing is failing nothing was logged to the logs, i started to get errors to console when i changed https://github.com/decred/dcrtime/blob/master/dcrtimed/backend/filesystem/filesystem.go#L333 to basic fmt.println:

flushing!
Construct
grrrrrrzzzzz // error in transaction construct
flush 20200610.234400: flush Construct tx: rpc error: code = Unknown desc = wallet.NewUnsignedTransaction: policy violation:: txauthor.NewUnsignedTransaction: generating next address violates the unused address gap limit policy
1591832460
flushing!
Construct
grrrrrrzzzzz
flush 20200610.234100: flush Construct tx: rpc error: code = Unknown desc = wallet.NewUnsignedTransaction: policy violation:: txauthor.NewUnsignedTransaction: generating next address violates the unused address gap limit policy
1591832100
flushing!
Construct
grrrrrrzzzzz
flush 20200610.233500: flush Construct tx: rpc error: code = Unknown desc = wallet.NewUnsignedTransaction: policy violation:: txauthor.NewUnsignedTransaction: generating next address violates the unused address gap limit policy
1591831980
flushing!
Construct
grrrrrrzzzzz
flush 20200610.233300: flush Construct tx: rpc error: code = Unknown desc = wallet.NewUnsignedTransaction: policy violation:: txauthor.NewUnsignedTransaction: generating next address violates the unused address gap limit policy
1591831320
all flushed!

Also, looks like the digest FlushRecord is dismissed from cache/ marked as flushed, even tho the transactions weren't published/confirmed, and now it's stuck on the same loop testnet is currently on:

anchoring time -> construct transaction for cached records -> gap limit -> fail silently & dismiss cached record? -> re-stamp old digest -> digest accepted -> anchoring time -> gap limit -> ...