fix spend amounts to save credits

This commit is contained in:
Niko Storni 2022-01-26 07:11:26 +01:00
parent 7ff1a009da
commit 0d0d39380c
4 changed files with 11 additions and 5 deletions

View file

@ -81,6 +81,7 @@ services:
- walletserver
environment:
- LBRY_STREAMING_SERVER=0.0.0.0:5280
- LBRY_FEE_PER_NAME_CHAR=0
volumes:
- "./persist/.lbrynet:/home/lbrynet"
- ".:/etc/lbry" #Put your daemon_settings.yml here

View file

@ -110,7 +110,7 @@ func (s *Sync) walletSetup() error {
}
requiredBalance := float64(unallocatedVideos)*(publishAmount+estimatedMaxTxFee) + channelFee
if s.Manager.CliFlags.UpgradeMetadata {
requiredBalance += float64(notUpgradedCount) * 0.001
requiredBalance += float64(notUpgradedCount) * estimatedMaxTxFee
}
refillAmount := 0.0
@ -127,6 +127,12 @@ func (s *Sync) walletSetup() error {
if err != nil {
return errors.Err(err)
}
} else if balance > requiredBalance {
extraLBC := balance - requiredBalance
if extraLBC > 5 {
sendBackAmount := extraLBC - 1
logUtils.SendInfoToSlack("channel %s has %.1f credits which is %.1f more than it should. We should send at least %.1f that back.", s.DbChannelData.ChannelId, balance, extraLBC, sendBackAmount)
}
}
claimAddress, err := s.daemon.AddressList(nil, nil, 1, 20)

View file

@ -241,7 +241,7 @@ func transferVideos(s *Sync) error {
},
},
},
Bid: util.PtrToString("0.005"), // Todo - Dont hardcode
Bid: util.PtrToString(fmt.Sprintf("%.5f", publishAmount/2.)),
}
videoStatus := shared.VideoStatus{
ChannelID: s.DbChannelData.ChannelId,

View file

@ -33,11 +33,10 @@ import (
const (
channelClaimAmount = 0.01
estimatedMaxTxFee = 0.1
estimatedMaxTxFee = 0.0015
minimumAccountBalance = 1.0
minimumRefillAmount = 1
publishAmount = 0.01
maxReasonLength = 500
publishAmount = 0.002
)
// Sync stores the options that control how syncing happens