mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 13:21:37 +00:00
all: fix whitespace (#1572)
This commit is contained in:
parent
aafcae3b28
commit
d20f91057a
21 changed files with 0 additions and 31 deletions
|
|
@ -10,5 +10,4 @@ func EncodeBytesItem(val interface{}) ([]byte, error) {
|
|||
|
||||
func DecodeBytesItem(bytes []byte, val interface{}) error {
|
||||
return rlp.DecodeBytes(bytes, val)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -396,7 +396,6 @@ func VerifyBalance(isXDCXLendingFork bool, statedb *state.StateDB, lendingStateD
|
|||
return fmt.Errorf("VerifyBalance: not enough balance to process payment for lendingTrade."+
|
||||
"lendingTradeId: %v. Token: %s. ExpectedBalance: %s. ActualBalance: %s",
|
||||
lendingTradeId, lendingTrade.LendingToken.Hex(), paymentBalance.String(), tokenBalance.String())
|
||||
|
||||
}
|
||||
case Market, Limit:
|
||||
switch side {
|
||||
|
|
@ -421,7 +420,6 @@ func VerifyBalance(isXDCXLendingFork bool, statedb *state.StateDB, lendingStateD
|
|||
if defaultFeeInXDC.Cmp(common.RelayerLendingFee) <= 0 {
|
||||
return ErrQuantityTradeTooSmall
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case LendingStatusCancelled:
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ func GetSettleBalance(isXDCXLendingFork bool,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
collateralQuantity := new(big.Int).Mul(quantityToLend, collateralTokenDecimal)
|
||||
collateralQuantity = new(big.Int).Mul(collateralQuantity, depositRate) // eg: depositRate = 150%
|
||||
collateralQuantity = new(big.Int).Div(collateralQuantity, big.NewInt(100))
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import (
|
|||
)
|
||||
|
||||
func TestCalculateSignersVote(t *testing.T) {
|
||||
|
||||
info := make(map[string]SignerTypes)
|
||||
votes := utils.NewPool()
|
||||
masternodes := []common.Address{{1}, {2}, {3}}
|
||||
|
|
@ -46,7 +45,6 @@ func TestCalculateSignersVote(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCalculateSignersTimeout(t *testing.T) {
|
||||
|
||||
info := make(map[string]SignerTypes)
|
||||
timeouts := utils.NewPool()
|
||||
masternodes := []common.Address{{1}, {2}, {3}}
|
||||
|
|
|
|||
|
|
@ -211,7 +211,6 @@ func (x *XDPoS_v2) initial(chain consensus.ChainReader, header *types.Header) er
|
|||
// can not call processQC because round is equal to default
|
||||
x.currentRound = 1
|
||||
x.highestQuorumCert = quorumCert
|
||||
|
||||
} else {
|
||||
log.Info("[initial] highest QC from current header")
|
||||
quorumCert, _, _, err = x.getExtraFields(header)
|
||||
|
|
@ -306,7 +305,6 @@ func (x *XDPoS_v2) YourTurn(chain consensus.ChainReader, parent *types.Header, s
|
|||
// Prepare implements consensus.Engine, preparing all the consensus fields of the
|
||||
// header for running the transactions on top.
|
||||
func (x *XDPoS_v2) Prepare(chain consensus.ChainReader, header *types.Header) error {
|
||||
|
||||
x.lock.RLock()
|
||||
currentRound := x.currentRound
|
||||
highestQC := x.highestQuorumCert
|
||||
|
|
|
|||
|
|
@ -209,7 +209,6 @@ func (x *XDPoS_v2) GetEpochSwitchInfoBetween(chain consensus.ChainReader, begin,
|
|||
if iteratorNum.Cmp(begin.Number) >= 0 {
|
||||
infos = append(infos, epochSwitchInfo)
|
||||
}
|
||||
|
||||
}
|
||||
// reverse the array
|
||||
for i := 0; i < len(infos)/2; i++ {
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ func (x *XDPoS_v2) processSyncInfoPool(chain consensus.ChainReader) {
|
|||
}
|
||||
|
||||
func (x *XDPoS_v2) verifySignatures(messageHash common.Hash, signatures []types.Signature, candidates []common.Address) error {
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(signatures))
|
||||
var haveError error
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ func ecrecover(header *types.Header, sigcache *utils.SigLRU) (common.Address, er
|
|||
|
||||
sigcache.Add(hash, signer)
|
||||
return signer, nil
|
||||
|
||||
}
|
||||
|
||||
// Get masternodes address from checkpoint Header. Only used for v1 last block
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ func RandStringBytes(n int) string {
|
|||
}
|
||||
|
||||
func getCommonBackend(t *testing.T, chainConfig *params.ChainConfig) *backends.SimulatedBackend {
|
||||
|
||||
// initial helper backend
|
||||
contractBackendForSC := backends.NewXDCSimulatedBackend(types.GenesisAlloc{
|
||||
voterAddr: {Balance: new(big.Int).SetUint64(10000000000)},
|
||||
|
|
|
|||
|
|
@ -2917,7 +2917,6 @@ func (bc *BlockChain) logLendingData(block *types.Block) {
|
|||
}()
|
||||
|
||||
for _, batch := range batches {
|
||||
|
||||
dirtyOrderCount := uint64(0)
|
||||
for _, item := range batch.Data {
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -873,7 +873,6 @@ func TestChainTxReorgs(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLogReorgs(t *testing.T) {
|
||||
|
||||
var (
|
||||
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
|
||||
|
|
@ -1436,7 +1435,6 @@ func benchmarkLargeNumberOfValueToNonexisting(b *testing.B, numTxs, numBlocks in
|
|||
b.StopTimer()
|
||||
if got := chain.CurrentBlock().Transactions().Len(); got != numTxs*numBlocks {
|
||||
b.Fatalf("Transactions were not included, expected %d, got %d", (numTxs * numBlocks), got)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1577,7 +1575,6 @@ func TestAreTwoBlocksSamePath(t *testing.T) {
|
|||
t.Error("Failed")
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// TestEIP2718Transition tests that an EIP-2718 transaction will be accepted
|
||||
|
|
|
|||
|
|
@ -214,7 +214,6 @@ func (tx *LendingTransaction) WithSignature(signer LendingSigner, sig []byte) (*
|
|||
|
||||
// ImportSignature make lending tx with specific signature
|
||||
func (tx *LendingTransaction) ImportSignature(V, R, S *big.Int) *LendingTransaction {
|
||||
|
||||
if V != nil {
|
||||
tx.data.V = V
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ func MarshalSignature(R, S, V *big.Int) ([]byte, error) {
|
|||
|
||||
// Sender get signer from
|
||||
func (ordersign OrderTxSigner) Sender(tx *OrderTransaction) (common.Address, error) {
|
||||
|
||||
message := crypto.Keccak256(
|
||||
[]byte("\x19Ethereum Signed Message:\n32"),
|
||||
ordersign.Hash(tx).Bytes(),
|
||||
|
|
|
|||
|
|
@ -281,11 +281,9 @@ func TestInnerProductVerifyFastLen64Rand(t *testing.T) {
|
|||
t.Error("Inner Product Proof incorrect")
|
||||
fmt.Printf("Values Used: \n\ta = %s\n\tb = %s\n", a, b)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestMRPProveZERO(t *testing.T) {
|
||||
|
||||
mRangeProof, _ := MRPProve([]*big.Int{
|
||||
new(big.Int).SetInt64(0),
|
||||
})
|
||||
|
|
@ -294,7 +292,6 @@ func TestMRPProveZERO(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMRPProve_MAX_2_POW_64(t *testing.T) {
|
||||
|
||||
mRangeProof, _ := MRPProve([]*big.Int{
|
||||
new(big.Int).SetUint64(0xFFFFFFFFFFFFFFFF),
|
||||
})
|
||||
|
|
@ -303,7 +300,6 @@ func TestMRPProve_MAX_2_POW_64(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMRPProveOutOfSupportedRange(t *testing.T) {
|
||||
|
||||
value, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFF", 16)
|
||||
_, err := MRPProve([]*big.Int{
|
||||
value,
|
||||
|
|
@ -312,7 +308,6 @@ func TestMRPProveOutOfSupportedRange(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMRPProve_RANDOM(t *testing.T) {
|
||||
|
||||
mRangeProof, _ := MRPProve(Rand64Vector(1))
|
||||
mv := MRPVerify(&mRangeProof)
|
||||
assert.Equal(t, mv, true, " MRProof incorrect")
|
||||
|
|
@ -343,7 +338,6 @@ func Rand64Vector(l int) []*big.Int {
|
|||
}
|
||||
|
||||
func TestMRPProveValueNumberNotSupported(t *testing.T) {
|
||||
|
||||
_, err := MRPProve(Rand64Vector(3))
|
||||
assert.NotNil(t, err, "MRProof incorrect - accepted 3 inputs")
|
||||
|
||||
|
|
|
|||
|
|
@ -312,7 +312,6 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {
|
|||
t.Errorf("got: %s; want: %s", got, want)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func iterateKeys(it ethdb.Iterator) []string {
|
||||
|
|
|
|||
|
|
@ -2071,7 +2071,6 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c
|
|||
|
||||
// SubmitTransaction is a helper function that submits tx to txPool and logs a message.
|
||||
func submitOrderTransaction(ctx context.Context, b Backend, tx *types.OrderTransaction) (common.Hash, error) {
|
||||
|
||||
if err := b.SendOrderTx(ctx, tx); err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,6 @@ func (ctx ppctx) fields(obj *goja.Object) []string {
|
|||
vals = append(vals, k)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
iterOwnAndConstructorKeys(ctx.vm, obj, add)
|
||||
sort.Strings(vals)
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ func (t *rlpx) close(err error) {
|
|||
}
|
||||
|
||||
func (t *rlpx) doProtoHandshake(our *protoHandshake) (their *protoHandshake, err error) {
|
||||
|
||||
// Writing our handshake happens concurrently, we prefer
|
||||
// returning the handshake read error. If the remote side
|
||||
// disconnects us early with a valid reason, we should return it
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@ func (sn *SimNode) Start(snapshots map[string][]byte) error {
|
|||
serviceFunc := sn.adapter.lifecycles[name]
|
||||
service, err := serviceFunc(ctx, sn.node)
|
||||
if err != nil {
|
||||
|
||||
regErr = err
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ func main() {
|
|||
var adapter adapters.NodeAdapter
|
||||
|
||||
switch *adapterType {
|
||||
|
||||
case "sim":
|
||||
log.Info("using sim adapter")
|
||||
adapter = adapters.NewSimAdapter(services)
|
||||
|
|
|
|||
|
|
@ -234,7 +234,6 @@ func (net *Network) watchPeerEvents(id discover.NodeID, events chan *p2p.PeerEve
|
|||
}
|
||||
peer := event.Peer
|
||||
switch event.Type {
|
||||
|
||||
case p2p.PeerEventTypeAdd:
|
||||
net.DidConnect(id, peer)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue