Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy rewards redistribution #279

Merged
merged 18 commits into from
Apr 19, 2021
Merged

Conversation

bvbfan
Copy link
Contributor

@bvbfan bvbfan commented Mar 10, 2021

/kind feature

I plan to run it in real sync, i have another idea using undos, probably will give a try in another repo. For now we have pool commissions updates on every block, we can fork out by next hard fork. Account rewards are updated before every addition/subtract, optionally we can do it before subtraction only.

Fixes https://github.com/cakedefi/defichain-private/issues/347

@bvbfan bvbfan added this to the 1.6.x milestone Mar 10, 2021
@bvbfan bvbfan requested a review from a team as a code owner March 10, 2021 15:03
@bvbfan bvbfan force-pushed the feature/lazy_rewards_redistribution branch 3 times, most recently from 84f8c96 to dce6ce8 Compare March 11, 2021 07:43
Copy link
Contributor

@uzyn uzyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @bvbfan

Let's test it on testnet or devnet and run some LM with rewards for a couple of weeks. Would be interesting to see how well it performs.

@ShengguangXiao
Copy link
Contributor

ShengguangXiao commented Mar 11, 2021

So this change need to clear all the DB files and sync from genesis block? I cannot sync with testnet with this branch @bvbfan

@bvbfan
Copy link
Contributor Author

bvbfan commented Mar 11, 2021

Yep, it should tell that DB is incompatible. I'll resolve the conflicts and will investigate on failing tests.

src/masternodes/mn_checks.h Outdated Show resolved Hide resolved
@bvbfan bvbfan force-pushed the feature/lazy_rewards_redistribution branch 2 times, most recently from ea88faa to feae53a Compare March 16, 2021 07:24
@bvbfan bvbfan force-pushed the feature/lazy_rewards_redistribution branch 2 times, most recently from a6b1da9 to 046d0a2 Compare March 23, 2021 07:34
@ShengguangXiao
Copy link
Contributor

ShengguangXiao commented Mar 23, 2021

Try to do a clean sync with testnet, but failed in between with some errors.

2021-03-23T08:40:42Z Synchronizing blockheaders, height: 296669 (~100.00%)
2021-03-23T08:40:51Z Synchronizing blockheaders, height: 296670 (~100.00%)
2021-03-23T08:40:55Z UpdateTip: new best=0e16ff6d957c673ff766b02e011b491fe6537c319afe8efe8dd96d3bdf3c7ebf height=16981 version=0x20000000 log2_work=67.813508 tx=17054 date='2020-10-27T21:16:57Z' progress=0.044829 cache=4.6MiB(34004txo)
2021-03-23T08:41:15Z Synchronizing blockheaders, height: 296671 (~100.00%)
2021-03-23T08:41:16Z UpdateTip: new best=be3b6fd88ef5c4f5ce5296de5dafc643f875e79d465feb34070e64c7e246cb96 height=30045 version=0x20000000 log2_work=68.62052 tx=30192 date='2020-11-02T12:44:07Z' progress=0.079365 cache=8.2MiB(60178txo)
2021-03-23T08:41:16Z Synchronizing blockheaders, height: 296672 (~100.00%)
2021-03-23T08:41:21Z Synchronizing blockheaders, height: 296673 (~100.00%)
2021-03-23T08:41:23Z skipped tx a192ff4b9ae9b71a74506e0a0f99611840e9253f8056ae7915b4971357ac5658: UpdatePoolPairTx: CDataStream::read(): end of data: iostream error
2021-03-23T08:41:23Z skipped tx 407091d6013f3cae897a3c15af8c032ee21ffe63a134e5144cd0a3cc93bc2397: UpdatePoolPairTx: CDataStream::read(): end of data: iostream error
2021-03-23T08:41:23Z skipped tx f2c2188fe63fe983a510ce82daf78725810bc90f68fd61ba68fb9499e06334b0: UpdatePoolPairTx: CDataStream::read(): end of data: iostream error
2021-03-23T08:41:23Z skipped tx 846457d09e6cd2b3362d69f479489d9f33ef64cc388d5e64cef45088a203c16c: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:23Z skipped tx a0aedcb58362c9b2e7c606d925d42798d37b1f5a9a291df3912859489cd2708e: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:27Z skipped tx b33053c874275cdf1962e66086b03161a0698af0ddea69847f4d3d2b1b0775e7: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:27Z Synchronizing blockheaders, height: 296674 (~100.00%)
2021-03-23T08:41:37Z UpdateTip: new best=35b7d28fcf707053ea21d7fee2e9cea932d57dac941e457f154404686d1baf9c height=43112 version=0x20000000 log2_work=69.135927 tx=43426 date='2020-11-08T04:07:58Z' progress=0.114152 cache=11.4MiB(86352txo)
2021-03-23T08:41:39Z Synchronizing blockheaders, height: 296675 (~100.00%)
2021-03-23T08:41:42Z skipped tx 6a107f1e94f801ef3ce0ad451e44704382d67a683436c69cb81e23c47da22eb1: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx 1d5ffabb901b5b88aab18d23392f8463a578b7c90a9210095725a3abb2ab5a4c: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx 09e88e570dad1c2bc34d204bbbf42b99e02d48422a13c42da1720d983a70f17b: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx 8ed2cd4b86468a21b90747cb1db4bb2d010bb449c1a13c3641454b54d2bbd289: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx 5b62836449c2fe0af70440ac159448cb4917a760a0ee781abc6aa6dca76e5561: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx 721f795b0609b0cd5e4df9ccb8b12d0ea87d0e1508b094c4008533bff3a8c8b7: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx d22ab8ee88b0a1e8ea0d7ede0d6cfdbac1da89bcff82c1605e2dd25cb1dc26ca: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx b0d050389db821ffc85ee4c55b812ff4c333ed40fdcdb086f00282be3deaa19c: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx 91e792d97472a2130851d502295de633d551b3c74b65609ff4b7e050a5c1026f: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx 965f11f9ac0c8cae37d0e58cdade6eb8531668e6f64a077a538eb453bf146544: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:42Z skipped tx 7d0e54b4d896a794bbc999ade574b0a6d2ce39c974b6bd7f84d5172a8f60b193: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:46Z Pre-allocating up to position 0x400000 in rev00000.dat
2021-03-23T08:41:50Z Synchronizing blockheaders, height: 296676 (~100.00%)
2021-03-23T08:41:58Z UpdateTip: new best=7840323a4fc08c5766d55067a20895d2478aa08f277f22fa716a839d8fc014ff height=52549 version=0x20000000 log2_work=69.414301 tx=53050 date='2020-11-12T04:55:35Z' progress=0.139450 cache=13.7MiB(105269txo)
2021-03-23T08:41:58Z skipped tx 457e6a14ccee11160d68af4890ca2a6bc92d09631268b47780011a270557f93b: AddPoolLiquidityTx: amount 9459364810 is less than 10000000000
2021-03-23T08:41:59Z skipped tx eee2ef51bc6923af65a6e90203fcbb7c0b735cd461ec8187265ca93033115beb: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:41:59Z skipped tx 610a25838c2b565f42355fa9be7c6ccd8562e0274327dbba0f92da9de915f7b8: RemovePoolLiquidityTx: amount 82179427 is less than 82465255
2021-03-23T08:41:59Z skipped tx 293dbcf4a2497dab24cb16adb0b38e820874d016efbd94d250f3f9222ea3f246: RemovePoolLiquidityTx: amount 41089488 is less than 41089604
2021-03-23T08:42:18Z Pre-allocating up to position 0x4000000 in blk00000.dat
2021-03-23T08:42:19Z UpdateTip: new best=920fe796d530b002945e9f9f7fed43cd8be4c164e89473d2f88e089df50651c8 height=64014 version=0x20000000 log2_work=69.702782 tx=64621 date='2020-11-17T04:45:01Z' progress=0.169866 cache=17.3MiB(128243txo)
2021-03-23T08:42:24Z Pre-allocating up to position 0x600000 in rev00000.dat
2021-03-23T08:42:25Z skipped tx 098331875da79cc4984753774c00440bec4ab386a0d8dba2b8de823b600d6ab1: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:27Z skipped tx e249f6e5773f7b998e6345721a99624c683a59800ff5f32ab253a7ce3dbbca8f: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:29Z skipped tx ef73fffe1ca8318a34a474f1e72514284f7b0f332781e184c189a13d06d1152f: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:30Z skipped tx 6c8eaa51142b069305e07aea0ee247a467f1fc7d1378428005b8034e069e8cda: AccountToAccountTx: amount 0 is less than 119632800
2021-03-23T08:42:30Z skipped tx 9dbd8e2f2f331e0d314968baedaf49065e45fbd0316c95e8e1e02548437a76f4: AccountToAccountTx: amount 0 is less than 119632800
2021-03-23T08:42:30Z skipped tx 4f5f620484e5359eafb9fe799b568a59ca75202bfe6aa1546c54820c99889437: AccountToAccountTx: amount 0 is less than 119632800
2021-03-23T08:42:34Z skipped tx 2578a1330f3a74f3c465766909913bcf5fbd97e7ff63ac85be19dffef5040ce8: RemovePoolLiquidityTx: amount 0 is less than 1000000000
2021-03-23T08:42:36Z skipped tx c8e28815eab3d8b0a48baa7c9d42922ca916f1ecf9f35e0da878d99f27ccf8d6: RemovePoolLiquidityTx: amount 37590248 is less than 42048966
2021-03-23T08:42:37Z skipped tx d4fd57281f72a8533a9b9c2781e4b9aac277218619ba35bf8fce3e115e106a4a: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:37Z skipped tx 53f8759c3f4d7d2c4c217c89d00e3d92f1c162a09d673f545d7e57fd87252d1f: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:37Z skipped tx 9af9dac16edc70a1337526d2f761bc3a1b48690fe136c9a61626656f5fd874e5: AddPoolLiquidityTx: amount 461486577 is less than 461491190
2021-03-23T08:42:37Z skipped tx bcac69c321db4203073e2066bd602e1ffc878b8e73e1a2a41ec8c1fdc8f673ef: AddPoolLiquidityTx: amount 449005795480 is less than 461491188919
2021-03-23T08:42:38Z skipped tx 7fccb4f541d8bd952463f09d01575c184d100c719265165603f439034977663f: RemovePoolLiquidityTx: amount 0 is less than 269113084
2021-03-23T08:42:38Z skipped tx f314d0a8fc4a26e1a2bee20e741e1ed0984be3df86d6c57a818a1acb3c2ce7b7: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 44badd4561649b6361f4e6ff3fd4854ec971157c23f2e175f07b1cadc50fbd58: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx ea609ac06952e78aee8820f801956e2c1df96ae43fb28bf239c4ee16fe7554fd: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx d05093a740e33a16081dd458f142e883277f24431eb8efb73c9cb5d141b625a3: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx b15b4ade7a131b82b15b5aa839d7fdb44628b2499e3fb40a3bfb64e71deb85b0: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx bb4dcacd5169b46b1a5f59dc0760b657fc4f16881f8a1e5d491be48ed5a9ac5c: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 5e3b3d896cb63f75e38b50506df39ce2183bee176e53e9a0fe28be229c3aa20a: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 4fc46309250b59ed471677065716492c69947d1a5b73b58421d131631415dd3a: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 4a12b6d5fe7ead1fe119857f08c5b5324e4bfabb829fe49d3a687c5f6c1cde40: AddPoolLiquidityTx: amount 8270002019 is less than 25061832475
2021-03-23T08:42:38Z skipped tx 0e071b411db71d23e4871c99e722c7c9e38dcc8a13605ccc0840a028974274a7: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx baa14553fde2894256a749f93c49caba02bdc2e4b0fc61e9fb352816b57eac33: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx cff957f9a3939454d359dabb8211d4ce500187f7d2570adad1192c309b8e6890: AddPoolLiquidityTx: amount 19308568985 is less than 90557738409
2021-03-23T08:42:38Z skipped tx 01d23c07f8191368dc04448c62167d595348bcddb3d2f71e4fbe36799680ad74: AddPoolLiquidityTx: amount 4122205311 is less than 5000000000
2021-03-23T08:42:38Z skipped tx 48417a7582f6dd77fbfccc4beba5e80d49ad71406d95951ff7e9b632009027fd: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 9b574778cc6839903f7359c687013c11f44b4266abeb6616da43d950f1c8c4f6: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx c1c73f42a83b92e701144250d71bda7a0b93f87ffeb0e2507ba664906295d4b2: AddPoolLiquidityTx: amount 19308568985 is less than 80263317653
2021-03-23T08:42:38Z skipped tx 30f6a8dbf22b0fe5a2456798705e592c767cd87378abf87701d33d715bddd237: AddPoolLiquidityTx: amount 19308568985 is less than 79052963051
2021-03-23T08:42:38Z skipped tx 8e35491f0f01d1292291e5de437d9b94390a393b96d4fbb0d55ff427d9481352: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx f2eef08f19f04d39f21b466b77d114a0fa6716df8f21f0bdf464241e5cb83527: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx cc1b440dbc439df1350bcbfa906afdf906e3c70aba2d5e02d45e279be406c934: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 4d9df3e2e4bcb9a3a1e45c279ba4017b35dbda74c8a89f7131a81537d26ae8b1: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 7c0c72d37d59eb73234e38847b9ba8def07d7bdbd90b5354fd98c4d9f9af5935: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx b35daad5ec330b398d5b017f74234754cbec44b2d23670335000787f407eff95: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 2884abdcc669833063350f80acc3078c064946c23be921ba19c54c52fc01b716: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx bb1e29401419f8ef01b00c467741e3d120797c6ef32c497ee98c1bf08be0654f: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 7e41e28a1eb46f26a05d1d5397683b1422c35e08c34189ae8f22cab654232571: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx a2cd6468596629dd1fe211e89f0a4e78a4e0b0281b96db8800cf0dd77ec8ed41: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx d7fc45896754d8b1d8170e7150c36e7be1a72e4dd3e3eaa1a0eb6c07d9ecf2f7: RemovePoolLiquidityTx: amount 41089713 is less than 41135920
2021-03-23T08:42:38Z skipped tx 439f37ce1843238567724708cf4af8dbeefd23868af5b242932fd6cf038b78c5: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx dc5a168da7ee8e436bb09b5b8091dd31728e908c9b90be11d0658a034559fb60: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 207af8333767465ebb4cf7f3a77ab26fbe7291d6c0dc0790df5abfb8936e3115: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 3a8a63df5fe1588001ea6450ad20f02bbb051ca0cdcdd40ee0825d795ee71b19: AddPoolLiquidityTx: amount 8373141018 is less than 12500000000
2021-03-23T08:42:38Z skipped tx be4d91d7b9fa1709c65b42ea48854ddd1aba765903e3d8fc8795144d82c424e1: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 3b509718140cac9df26de010553224e705ba81433a8a90e2b4edf335e24ce2cb: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx f192a5fb8489b190d2ad3cb60346617ee4ba490b734901645e90cb98e6cbbe98: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx c8867fce5fc3e3dc51244576e7e0bbbce7c04ce2e2f43e147e7c6ac25594e53d: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx a3e612f346ecc1d1d94b80229d126c34099ca650b144f766bd944f06190b9f51: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 576aaeb481687006946c6d495979b4998e3deb4b3529009522378e4b95ff475b: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:38Z skipped tx 0f6e356ef18ee78ca01ebba539cb9c2ad3d4cfc802ea2039736a0de5325f3885: AddPoolLiquidityTx: amount 7532937425 is less than 30000000000
2021-03-23T08:42:39Z skipped tx bb1715db0c661c6f11b3037c28a225d8ec6fbfe50c5a084ffc2646b4338f06c2: AddPoolLiquidityTx: amount 8639642817 is less than 83989954586
2021-03-23T08:42:39Z skipped tx 7d07e2302dcf8e86bfd86e2455095bb9fd1c7bfab6d532f20db01c00c4ee5ecc: AddPoolLiquidityTx: amount 0 is less than 100000000
2021-03-23T08:42:39Z skipped tx e4018659997c0113d19bf84e36d5f58187e2fe808f9b5a7b0a575e27f83cecad: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:39Z skipped tx a8e0400843ad992ade7bf784b2c9212ba69047c0b4939406f64a50aeffcd0a95: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:40Z UpdateTip: new best=55eef36c6821411b8de8cb33254dac84fac0e46dd3d5f1409510ec5347efbbef height=72514 version=0x20000000 log2_work=69.87955 tx=73998 date='2020-11-20T21:35:03Z' progress=0.194515 cache=19.4MiB(145534txo)
2021-03-23T08:42:41Z skipped tx 24ad96dde9558e42e3619e9fdc2e053a4e7f42c2832d0b27ae1c9ed7954a5249: AddPoolLiquidityTx: amount 0 is less than 25000000000
2021-03-23T08:42:43Z New outbound peer connected: version: 70016, blocks=296676, peer=8
2021-03-23T08:42:43Z skipped tx a73ae3410cdf0886899e719474b8826181dfd2fd6348cf4689b5f008c9b6d859: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:43Z skipped tx 80de0cb33e65d00a5e29375db4fb63fd481cc06d86bef3dc2ef3fae9ef9863e9: AddPoolLiquidityTx: amount 117670133820 is less than 9000000000000
2021-03-23T08:42:43Z skipped tx d26907b0d4d38e74ecce1d45e69bf49dcedb7ed763974787ada123db3ea398c6: AddPoolLiquidityTx: amount 0 is less than 10000000000
2021-03-23T08:42:44Z skipped tx cd5b502169f6da4c0c2de85d3e632c8769257167d055980fe891dda69b38c0b6: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:44Z skipped tx a3f8c64a7f16d2830c14850e46b14a6ecb94f8a51ccf396f1bcd51293e9bd38b: AddPoolLiquidityTx: amount 9137707214 is less than 14123766134
2021-03-23T08:42:44Z skipped tx e4d700297f40afe4e543fe52af253f9306c437690b9b78112f94329cddeb77ad: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:46Z skipped tx 1fdeafdee449f1ba7c84366917c052b636987de9ebc5259a2852e05529276ca3: RemovePoolLiquidityTx: amount 369655796 is less than 369853906
2021-03-23T08:42:46Z skipped tx 57b652cc12d9784ce854a17fd3add702e011643a53acc7cb8d3deb79003a5f8f: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:46Z skipped tx 0f62e44f821a79a97d2336fed45c732f613e2412c645821ca9b052487c61d526: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:46Z skipped tx cb4a3dca8b14b1d4ce54119784ad8675520b1b1145f86739cc4fdf98cae98670: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:46Z skipped tx 91a1c21399aa9616cf0f15fd96ccb2af8fe1b34a92a0bf2dc655eed9b17073bf: AddPoolLiquidityTx: amount 508354750 is less than 50000000000
2021-03-23T08:42:47Z skipped tx 5f72e52095b210fb26b6c87dd5b4743f697a2e3b139abd4d88167192ea26702f: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:47Z skipped tx abcfdac574bff9a1057ad06d7eec661507723211a4fe59db7aacdf39c710c656: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:47Z skipped tx 37fcf4e4d0829d626168d7f7452ce71e63985f43d56a999667bcf0088e510b6a: AddPoolLiquidityTx: amount 8813090726 is less than 64879106454
2021-03-23T08:42:47Z skipped tx a832742fa411c140f8f449b8f339d2c678e8a0a27b87dd97864111f2639a2a49: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:47Z skipped tx 64b992bcd39793d922d2596f031c0499b10d4672368fc8e59cb15cc9e04aa0d3: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:47Z skipped tx a5416fb71ec23b5c454636ebacb4456e0ae4a0401c809d89c8f153250ee0117b: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:47Z skipped tx 66ff4a85bfe48e53ca183d005fcdea037795e616ff7ee8e4f299b9d93caafcf1: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:47Z skipped tx 085a129504fae0d0e6ac2c71dece1a946dd2cd7e836968d6c44d870d079af698: AddPoolLiquidityTx: amount 508354750 is less than 100000000000
2021-03-23T08:42:47Z skipped tx 7a2b2f6bbbec55ec7d36cae150f3eb7a3bdc83d534151796cdf595d3e9271c43: AddPoolLiquidityTx: amount 508354750 is less than 11408969763
2021-03-23T08:42:49Z skipped tx 41c27259634fc65a9ad8ee85ad080964a5464998804db00b298ae16fe03d21a2: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:50Z skipped tx 08e864402d066cb7e0f65f587c2450c03f982f04b06728f455df0930a1f062dc: AccountToAccountTx: amount 0 is less than 1134834410
2021-03-23T08:42:50Z skipped tx a20faada80dc028a821cf5c3889071442fe7d5f1487e669e907512f060da86e7: AccountToAccountTx: amount 0 is less than 1134834410
2021-03-23T08:42:50Z skipped tx 97cb98df139d608a79e277fe6edd4439867be032aa6463c13cab18de12632db3: AccountToAccountTx: amount 0 is less than 13766000000
2021-03-23T08:42:50Z skipped tx b90b85e05f58d73d339be4563bcbf6c9fd041a1ddf175538135fae96937453df: AccountToAccountTx: amount 0 is less than 20035000000
2021-03-23T08:42:50Z skipped tx 7b878c59c0fcb503361ab691b94854baa328d70773fc6b07defe893b292ac8ae: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:51Z skipped tx e87820cc3f423aa5512691c54d6c24d0e32b0b25ce42c22ca749e57c781a1183: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:51Z skipped tx 6f57494fbe2a4cd450b98540cea115d4237bca7f7c657db48ea86c86052cc196: PoolSwapTx: Pool trading is turned off!
2021-03-23T08:42:51Z ERROR: ConnectBlock: Consensus::CheckTxInputs: 355c501f35bf9fbd1cf42fdf4d6350475403eb638e618ac23cda7964d2a7b8cd, bad-txns-customtx, AccountToUtxosTx: amount 870748541252 is less than 886521030000 (code 16)
2021-03-23T08:42:51Z InvalidChainFound: invalid block=1040fd0fc3cb8bf3d544d982965aaac8e619e42dcae6b3c0a78683e9764304b3  height=78938  log2_work=70.002561  date=2020-11-23T15:54:53Z

@bvbfan
Copy link
Contributor Author

bvbfan commented Mar 23, 2021

@ShengguangXiao it looks like some serialization issue CDataStream::read(): end of data: iostream error will investigate, thanks for test.

@bvbfan
Copy link
Contributor Author

bvbfan commented Mar 23, 2021

Quick update:

struct CUpdatePoolPairMessage {
    DCT_ID poolId;
    bool status;
    CAmount commission;
    CScript ownerAddress;
    CBalances rewards;
};

I change serialization of DCT_ID and it's not same as previous, now it's VARINT compared to raw integer. Will update after sync on testnet.

@bvbfan bvbfan force-pushed the feature/lazy_rewards_redistribution branch from a7efc91 to 9f8e229 Compare March 23, 2021 12:47
@uzyn uzyn added the protocol Has network protocol changes label Mar 24, 2021
@bvbfan bvbfan force-pushed the feature/lazy_rewards_redistribution branch 3 times, most recently from daf8463 to 794e093 Compare March 29, 2021 06:12
@bvbfan bvbfan force-pushed the feature/lazy_rewards_redistribution branch from 794e093 to 4be2ba1 Compare April 1, 2021 13:52
@bvbfan bvbfan changed the title [WIP] Lazy rewards redistribution Lazy rewards redistribution Apr 1, 2021
@bvbfan bvbfan removed the wip label Apr 1, 2021
@bvbfan bvbfan force-pushed the feature/lazy_rewards_redistribution branch 2 times, most recently from c69916d to 7ce5df6 Compare April 7, 2021 05:39
@bvbfan bvbfan force-pushed the feature/lazy_rewards_redistribution branch from 43e698b to da3f4ce Compare April 13, 2021 08:02
@monstrobishi monstrobishi removed this from the 1.6.x milestone Apr 14, 2021
@monstrobishi monstrobishi changed the base branch from master to 1.7.x April 14, 2021 04:37
bvbfan and others added 16 commits April 14, 2021 17:23
Signed-off-by: Anthony Fieroni <[email protected]>
Per account rewards calculation

Signed-off-by: Anthony Fieroni <[email protected]>
Signed-off-by: Anthony Fieroni <[email protected]>
Signed-off-by: Anthony Fieroni <[email protected]>
Signed-off-by: Anthony Fieroni <[email protected]>
@bvbfan bvbfan force-pushed the feature/lazy_rewards_redistribution branch from 32ad17f to 15985c4 Compare April 14, 2021 14:24
@surangap surangap mentioned this pull request Apr 19, 2021
@monstrobishi monstrobishi merged commit 9a0e59c into 1.7.x Apr 19, 2021
@monstrobishi monstrobishi deleted the feature/lazy_rewards_redistribution branch April 19, 2021 07:38
monstrobishi added a commit that referenced this pull request May 24, 2021
* Randomise winning anchor on blockhash (#314)

* Randomise winning anchor on blockhash

* Remove unused function argument

* Lazy rewards redistribution (#279)

* Split custom tx processing into parsing and applying

Signed-off-by: Anthony Fieroni <[email protected]>

* Prevent copies in serialize

Signed-off-by: Anthony Fieroni <[email protected]>

* Adopt pool tables to have historical records
Per account rewards calculation

Signed-off-by: Anthony Fieroni <[email protected]>

* Do not redistribute rewards per block

Signed-off-by: Anthony Fieroni <[email protected]>

* Fix lint circular dependency

Signed-off-by: Anthony Fieroni <[email protected]>

* Introduce db version check at runtime

Signed-off-by: Anthony Fieroni <[email protected]>

* Use bidirectional storage iterators

Signed-off-by: Anthony Fieroni <[email protected]>

* Fix pool id serialization in update poolpair tx

Signed-off-by: Anthony Fieroni <[email protected]>

* Update rewards on every block as drop-in replacement

Signed-off-by: Anthony Fieroni <[email protected]>

* Split pool historical records

* Added EunosHeight

* Fork out rewards redistribution per block

Signed-off-by: Anthony Fieroni <[email protected]>

* Extend pool swap functional test to Eunos hieght

Signed-off-by: Anthony Fieroni <[email protected]>

* Minimize undo data size

Signed-off-by: Anthony Fieroni <[email protected]>

* Prune undo data prior last checkpoint

Signed-off-by: Anthony Fieroni <[email protected]>

* Prevent database fragmentation

Signed-off-by: Anthony Fieroni <[email protected]>

* Make account history own database (#323)

Signed-off-by: Anthony Fieroni <[email protected]>

Co-authored-by: surangap <[email protected]>
Co-authored-by: Ahmed Hilali <[email protected]>

* Split pool reward records (#332)

Signed-off-by: Anthony Fieroni <[email protected]>

* DFIP8 New emissions (#328)

* New emissions

* Use subsidy map

* Assign swap, futures and options to unallocated

* Show non-UTXO rewards in getblock

* Oracle development (#287)

* Oracle development

Signed-off-by: Anthony Fieroni <[email protected]>

* Fix rpc parameter not converted in defi-cli (#319)

* Update rpc_oracles.cpp

Fixed rpc documentation

* Updated devnet heights

Co-authored-by: Anthony Fieroni <[email protected]>
Co-authored-by: Ahmed Hilali <[email protected]>

* Fix compile error (#341)

* Fix build issue on GCC5

Signed-off-by: Anthony Fieroni <[email protected]>

* Fix unit test fail

* Updated branch matching for dev builds

* Updated dev build branch matching

* Feature/decodecustomtx (#340)

* Added GetBlockHash() function to retrieve the block hash given the transaction hash

* Added new RPC decodecustomtx

* Added tests for decodecustomtx RPC

* Added iswitness parameter to vRPCConvertParams in client.cpp

* Updated decodecustomtx RPC as per new requirements

* Updated decodecustomtx to use INT_MAX as default block height. Updated testing.

* Removed redundant code

* Added GetBlockHash() function to retrieve the block hash given the transaction hash

* Added new RPC decodecustomtx

* Added tests for decodecustomtx RPC

* Added iswitness parameter to vRPCConvertParams in client.cpp

* Updated decodecustomtx RPC as per new requirements

* Updated decodecustomtx to use INT_MAX as default block height. Updated testing.

* Removed redundant code

Co-authored-by: monstrobishi <[email protected]>

* Extend block merkle root by hash of account changes (#337)

Signed-off-by: Anthony Fieroni <[email protected]>

Co-authored-by: monstrobishi <[email protected]>

* spv_getfeerate. SPV wallet fee filter for HTLC. SPV reset on reindex. (#356)

* Added header functions back in to fix compile

* Refactor: RPC oracles take array instead of string (#367)

Signed-off-by: Anthony Fieroni <[email protected]>

* Track UTXO and tokens sent to burn address (#354)

* Track TX and non-TX burns. Zero foundation balances.

* Remove Qt from depends

* Remove unused variables (#372)

* lint: remove unused json (#373)

* Change difficulty adjust period (#378)

* Remove unused GUI support code (#379)

* Use block height when getting last block time for coin-age (#380)

* Added listaccounts RPC pagination test (#376)

* Added listaccounts RPC pagination test
Optimized Account iteration

* Better handle pagination in listaccounts

Signed-off-by: Anthony Fieroni <[email protected]>

Co-authored-by: Anthony Fieroni <[email protected]>

* Fix linter error

* Added hardfork heights

* Add creation fee for devnet (#388)

* Masternode creation requires authorization (#386)

Signed-off-by: Anthony Fieroni <[email protected]>

* Remove backwards compatible anchor code (#383)

* Change daily LP rewards automatically on subsidy reduction (#390)

* Minor lint fixes for 1.7.x (#392)

* Minor lint fix. Set Ubuntu 18.04 as minimum for tests and builds. (#393)

* lint: remove "dead" code

* Run lint on 1.x PRs. Ubuntu 18.04 minimum for tests and builds.

* Fix listaccount pagination after start one (#394)

Signed-off-by: Anthony Fieroni <[email protected]>

* ICX Orderbook (#335)

* Initial ICX orderbook development

* Inital development of ICX Orderbook

* Fixes and changes.

* Remove prints and small fix.

* Fix seed to hash calculation

* Optimize data structures.

* Fix searching HTLCs.

* Refactor data structures and flow, fixed PR issues

* Refactor data structures and flow, fixed PR issues

* Fix issues.

* Added incentives and fees. Fixed issue with CAmount multiply overflow. Fix tests and clean code. (#5)

* Add incentives and fees. Fix multiply overflow.

* Fix lint rpc mapping check

* Add poolpair id to governance variable for DFI/BTC price used in takerFee, minimum timeout for 2nd HTLC, added initial unit test, various fixes and code clean.

* Fix calculation of takerFee. Clean code.

* Get poolpair id from governance variable.

* Adding expiration for minimum timeout to EXT HTLC.

* Remove locking funds on makeoffer, fixes.

* Add initial test that add creation of poolpair.

* Added takerFeePerBTC gov var, adapted timeouts for htlcs, check in rpc for correct htlc timeouts, added more checks in test.

* Added key for ext htlc closed, addapted test and rpcs.

* Fill partial offer to complete order

* Test burn. Wip burn map in ConnectBlock. Tally tokens.

* ICX Set order owner on creation

* Fix regressions, reproducible crashes
Polish

Fixes: #374

Signed-off-by: Anthony Fieroni <[email protected]>

* Remove chain data from DB, refactor address storing only in order/offer, fix auth, polish and clean code.

* Add warning disclaimer

* Add creation fee for devnet

* Fixed HTLC timout check, refund partial takerFee on partial offer accept, added test case for BTC/DFI flow, added error test cases, polished code.

* Fixed expiration of offer and htlcs,  added check for open offer on submit htlc, added more test cases.

* Fix order expiration refund, add checkin rpc for htlc if order expires first, fixed and added tests.

* Fix findng poolpair and calculating DFI per BTC, adapted test,  rpc fix.

* Remove unnecessary check in GetBTCDFIPoolPair(), make BTC isDAT in error tests, change BTC blocks in DFI to 20.

* Masternode creation requires authorization (#386)

Signed-off-by: Anthony Fieroni <[email protected]>

* Polish correct offer prices in blockchain layer

Signed-off-by: Anthony Fieroni <[email protected]>

* Moving more checks from RPC to mn_checks, cleanup code

* Small fixes.

* Follow getburninfo at all steps. Set correct amounts.

* Fix lint

* Fix lint

* Fix typo.

Co-authored-by: Peter Bushnell <[email protected]>
Co-authored-by: monstrobishi <[email protected]>
Co-authored-by: Anthony Fieroni <[email protected]>

* Updated Eunos upgrade heights for mainnet and testnet (#391)

* Update chainparams.cpp (#396)

* Ignore but log merkle failures (#403)

* Start burn search from default CScript (#401)

* Skip old coinbase block post Eunos (#400)

* Close expired orders simplifications

Signed-off-by: Anthony Fieroni <[email protected]>

* Skip higher coinbase spent block post Eunos

Signed-off-by: Anthony Fieroni <[email protected]>

* Updated code to return correct lastblockcreationattempt in getmininginfo RPC (#399)

* Fixed operator ==

* Update chainparams.cpp

* Add account destruction address on testnet (#404)

* Skip merkle root check on startup (#405)

* Fix/prevent reverts (#408)

* Prevent chain revert past Eunos

Signed-off-by: Anthony Fieroni <[email protected]>

* Add consesus code to reject custom tx

Signed-off-by: Anthony Fieroni <[email protected]>

* Fix oracles rpc cli paramters (#409)

* Fix oracles rpc cli paramters

Signed-off-by: Anthony Fieroni <[email protected]>

* Update oracle input parameter validation

Signed-off-by: Anthony Fieroni <[email protected]>

* Fix masternode hash generation by adding time to custom tx (#410)

Signed-off-by: Anthony Fieroni <[email protected]>

* Set new testnet fork height. Revert merkle root checks. (#411)

* Prevent rewards calculation to shown in account history (#412)

Signed-off-by: Anthony Fieroni <[email protected]>

* Add checkpoint to testnet (#414)

* Reduce new fork height to two hours ahead (#415)

* Fix calculating owner rewards and returning takerFee on close offer. (#416)

* Increase masternode registration and resign delay (#419)

* SPV add call, fix Windows connection issue and set Eunos height. (#424)

* SPV getpeers

* SPV: Use non-blocking on Windows

* Set Eunos height on mainnet

* Use C String in peer_log to build on macOS

* Client-name capitalization fix (#425)

* Using ubuntu 18.04 to build for linux (#422)

* Increment PROTOCOL_VERSION (#426)

Co-authored-by: Peter John Bushnell <[email protected]>
Co-authored-by: Anthony Fieroni <[email protected]>
Co-authored-by: surangap <[email protected]>
Co-authored-by: Xiao Shengguang <[email protected]>
Co-authored-by: Mihailo Milenkovic <[email protected]>
Co-authored-by: U-Zyn Chua <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocol Has network protocol changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants